Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2001-05-18 09:50:23


Version 1 of "dlw_int.zip" in the vault solves the problem I had with
static_lb. The library has:

* New file "static_lb.hpp" that contains the "static_lb" template that
returns the truncated log-base-2 of its template parameter. This can be
helpful when needing to know the exact bit-size of a compile-time parameter.

* "integer_traits.hpp" was changed to use the "BOOST_STATIC_CONSTANT" macro,
and a case for "wchar_t" was added. The test file was changed to add the
"wchar_t" case and a macro replaced the problematic template function.

* New file "integer_mask.hpp" takes ideas from the CRC library and contains
the "high_bit_mask_t" and "low_bits_mask_t" class templates. The first
template returns the bit mask for a given position, the second a bit mask
for the lowest bits. There may be some undefined behavior in the test file.
There may be some problems, at least with my compiler, because the problem
in version zero was solved when I did this change:

    BOOST_STATIC_CONSTANT( unsigned long, lower_mask
     = (1ul << half_place) - 1/*low_bits_mask_t<half_place>::sig_bits*/ );

I posted a query about my original problem on Usenet, and a respondent said
my code worked right on GCC 3.0, so it may be a subtle problem on how CWP5.3
resolve compile-time constants.

* "integer.hpp" added sizing templates "int_max_value_t," "int_min_value_t,"
and "uint_value_t" based on the maximum or minimum value. The test file has
some errors, in the test cases for int_min_value_t for 16 and 8 in least and
8 in fast, anyone know why?

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

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