filox wrote:
> not sure is it a c++ or a c question, but since i'm using c++, i'll ask
> here...
> i would like to use bit operators (&, , <<), but on the type double,
> because it has 64 bits. unfortunately, it seems i can't do that. can i
> somehow define my own type that has the desired number of bits (i.e. using
> bit fields) and then use those operators on that type?
>
If all you need is 64 bits, most modern compiler have a built in type.
i.e.
typedef unsigned long long bits_64;
If you need more you can define your own type e.g.
struct bits128
{
bits_64 m_lo;
bits_64 m_hi;
};
bits128 Bits( bits_64 lo, bits_64 hi )
{
bits128 retval = { lo, hi };
return retval;
}
bits128 operator( const & bits128 lhs, const & bits128 rhs )
{
bits128 retval = { lhs.lo  rhs.lo, lhs.hi, rhs.hi };
}
.... plus a whole bunch more like this for all the other operators you need.
