Boost logo

Boost :

From: Maarten Kronenburg (M.Kronenburg_at_[hidden])
Date: 2006-05-25 10:41:32


"Jarrad Waterloo" <jwaterloo_at_[hidden]> wrote in message
news:20060524184833.5667B14A8001_at_dqmail.dynamicquest.com...
> Here are my comments concerning Maarten's infinite precision integer
draft.
> I would not wait to submit this library to boost before these following
> features because people are in need of it now.
>
> 1) The ability to extract sub integers out of an integer such as the
integer
> at bit offset 3 and length of 4. This is especially helpful in the area of
> RFID where large unsigned integers are partitioned into smaller integers.

Thanks for your comments.
Extracting sub integers can also be done with the bitwise operators,
for example partitioning the integer x into 4-bit length:
integer mask( 1 );
mask <<= 4;
--mask;
integer xsh( x ), temp;
while( !xsh.is_zero() )
{ temp = xsh & mask;
// do something with temp
  xsh >>= 4;
};
So this ability is already available.

> 2) The ability to convert integer to bases other than base 10; any really
> from base 2-36

The iostreams of the compilers I know only alow bases 8, 10 and 16,
see also [lib.std.manip] setbase manipulator.
The bases 2, 4, 5 can be easily converted from these bases.
The other bases don't seem to have a useful application;
they are also not supported for base type int, and not
supported by printf formats or stream manipulators.

> 3) An implementation of a fixed sized stack version of the
> integer_allocator. This may be useful for performance when someone is not
> working with an infinite precision integer but a very large one such as
512
> or 1024 bits.

Users can implement such an allocator by deriving from
integer_allocator, override and implement allocate,
reallocate and deallocate, and activate it.

> 4) An unsigned version of the integer class that benefits from the higher
> performance of unsigned operations

Users can implement an unsigned_integer by deriving from
integer, but this will not give any performance gain.
By the way I think base type unsigned int is also not faster than
base type int.

>
>
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk