From: Fredrik Blomqvist (fredrik_blomqvist_at_[hidden])
Date: 2003-05-20 18:52:38
When playing around with the mpl::bitwise functions I noticed that the
mpl::shift_right fails to take the sign of the argument type into account.
(MSV7, latest boost CVS)
I.e it does a sign extension even on unsigned types.
These two lines hopefully illustrate the problem (once again, on MSVC7)
>::value != ~0));
>::value == ~0));
(I would also suggest that test similar to the above should be added to the
The problem, as I understand it, comes from the implementation of
mpl::aux::typeof, which on VC7 degenerates into a plain 'long' (ie a signed
type) regardless of input type.
The simplest local workaround I found was just to pass the original,
unmodifed, type along to mpl::shift_right_c and perform a static_cast on the
input type. (I can ofcourse send a patch if this seems like a viable
Regarding mpl::aux::typeof. Even though the full implementation isn't
available, wouldn't it be possible
to have it preserve atleast the sign of the input type on broken platforms?
/ Fredrik Blomqvist
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk