-----Original Message----- From: Boost [mailto:boost-bounces@lists.boost.org] On Behalf Of Adam Wulkiewicz Sent: Saturday, June 29, 2013 12:43 PM To: boost@lists.boost.org Subject: Re: [boost] Any interest in bitstream class?
Hi,
Paul Long wrote:
What do you think? Should the bitstream library support multiple endian schemes in the bit stream or is big endian enough?
Various communication protocols or files may define the endianess of data differently. There are even cases like TIFF files which define the endianess of data in the header. Therefore this type of
library should
support different endianesses. It should also probably support switching them for the same stream multiple times. E.g. some manipulators could be provided:
namespace bs = boost::bitstream;
mystream >> bs::big >> my_int16 >> my_IEEE754_float_32 >> bs::little >> other_int16;
Of course the endianess of variables on a specific platform should be taken into account.
It could also support some non-C++ formats like 16-bit half precision or 128-bit quad precision floats. Some typedefs would probably be required in namespace boost::bitstream.
A proposal for floating-point typedefs http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3626.pdf may provide some help - eventually ;-) For example: "Specifying 128-bit precision The proposed typedef float128_t provides a standardized way to specify quadruple-precision (Quadruple-precision floatingpoint format) in C++." Paul --- Paul A. Bristow, Prizet Farmhouse, Kendal LA8 8AB UK +44 1539 561830 07714330204 pbristow@hetp.u-net.com