Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9235: Construction from binary data
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-10-12 16:27:01
#9235: Construction from binary data
-------------------------------+----------------------------
Reporter: psiha | Owner: johnmaddock
Type: Feature Requests | Status: reopened
Milestone: To Be Determined | Component: multiprecision
Version: Boost 1.54.0 | Severity: Optimization
Resolution: | Keywords:
-------------------------------+----------------------------
Changes (by johnmaddock):
* type: Bugs => Feature Requests
Comment:
It's not quite as trivial as you think: the internal data layout is highly
platform/compiler dependent. For example a 128-bit integer is represented
as 4 32 bit words on MSVC, but as a single 128-bit value on GCC-x64 (which
has {{{__int128}}}).
Re (1), conversion from a hex string is fast, but decimal string
conversion is heavyweight: of course they use the same routine though.
Your example(4) is solved by user-defined literals I believe - it's the
optimally efficient solution as it's all done at compile-time. For (3)
would get_byte/set_byte non-member functions (similar to the existing bit
twiddling functions) do the job? Note that these would only be efficient
for unsigned types: signed types would require a check for negative values
and the associated error handling - and yes that means exceptions.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9235#comment:5> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:14 UTC