Boost logo

Boost :

From: Johan Råde (rade_at_[hidden])
Date: 2006-08-04 08:40:33


Gennaro Prota wrote:
> On Fri, 4 Aug 2006 09:53:35 +0100, "John Maddock"

> There are also platforms that add parity, so you can get two 1 bits in
> the object representation.
>
> As I said, the code is widely portable (probably on all
> implementations supported by boost) not fully portable.

Do you think that

   inline bool signbit(float x)
   {
       // check that signbit_mask contains at most one 1 bit
       BOOST_ASSERT(!(signbit_mask & (signbit_mask - 1)));
       return binary_cast<boost::uint32_t>(x) & signbit_mask;
   }

is a good idea?
It seems a bit wasteful to make this check each time you call the
function signbit.

--Johan Råde


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