| header: | unsigned_int.hpp |
|---|---|
| implementation: | addition.hpp |
unsigned_int<> supports the shift operators.
All of the four operators take a right hand argument that is convertable to unsigned.
unsigned u = 0xE5 - 0x80; unsigned_int< 128 > a = 0xE5, b = a, c, d = u; b <<= (UINT_BITS - 7); c = a << (UINT_BITS - 7); u <<= (UINT_BITS - 7); d <<= (UINT_BITS - 7); CHECK( b == c ); CHECK( u == d ); CHECK( (b >> (UINT_BITS - 7)) == 0xE5 ); c = b; c >>= (UINT_BITS - 7); CHECK( c == 0xE5 ); b -= d; c = b >> UINT_BITS; CHECK( b != 0 && c == 1 );
Test Result: gcc34 Passed, msvc80 Passed, msvc71 Passed
Output
Ok