Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2003-05-21 08:20:08

Fredrik Blomqvist wrote:
> Hi

Hi Fredrik,

First of all, thanks for the report.

> 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)
> BOOST_STATIC_ASSERT((mpl::shift_right<mpl::size_t<~0>, mpl::size_t<1>
> >::value != ~0));
> BOOST_STATIC_ASSERT((mpl::shift_right<mpl::int_<~0>, mpl::size_t<1>
> >::value == ~0));
> (I would also suggest that test similar to the above should be added to
> regression suite)

Will do.

> The problem, as I understand it, comes from the implementation of
> mpl::aux::typeof, which on VC7 degenerates into a plain 'long' (ie a
> 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 solution)
> 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?

I'll definitely look into fixing the typeof so it does something more
meaningful than now. I'll let you know when it's in the CVS.

Thanks once more,

Boost list run by bdawes at, gregod at, cpdaniel at, john at