24 May 17:23
Re: [integer] Promotion of endian library code from vault
Scott McMurray <me22.ca+boost <at> gmail.com>
2008-05-24 15:23:11 GMT
2008-05-24 15:23:11 GMT
On Sat, May 24, 2008 at 7:45 AM, Beman Dawes <bdawes <at> acm.org> wrote: > Neil Mayhew wrote: >> The areas that I am interested in seeing more work done on are (1) >> making constructors "conditional" and (2) adding a bit-range access method. > > Do you have a proposed design for bit-range access? > > What is the use case or motivation for bit-range access? > Perhaps something based off of erlang's Bit Syntax? http://www.erlang.org/doc/reference_manual/expressions.html#6.16 Armstrong's Erlang book gives MPEG headers as an example of bit range access, among other things. So something like typedef bit_sequence< uint_t<11>, uint_t<2>, uint_t<2>, uint_t<1>, uint_t<4>, uint_t<2>, uint_t<1>, uint_t<9> > MPEG_header; Or if you're writing a linker to generate EXEs for windows (another example from Armstrong's book), typedef bit_sequence< little_endian< uint_t<32> >, // Characteristics little_endian< uint_t<32> >, // TimeDateStamp little_endian< uint_t<16> >, // MajorVersion little_endian< uint_t<16> >, // MinorVersion little_endian< uint_t<16> >, // NumberOfNamedEntries little_endian< uint_t<16> > // NumberOfIdEntries > image_resource_directory; Be fun to be able to get everything as a tuple, too, to be able to assign to a tie, pattern-matching style That interface works better for the bit ranges, though, I suppose, since little_endian< uint_t<32> > as a boost.endian type on its own would be far more convenient name-wise than having to get it through a tuple-style interface. Just thinking out loud, ~ Scott _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
RSS Feed