unsigned_int<> provides the multiplication operators * an *=.
Specialization's of operator * () calculates with, and returns the wider of the two types.
For operator *= () the calculation is done with the type of the left hand side, i.e. the right hand side is converted prior to doing the calculation.
unsigned_int< 128 > a( 10 ), c( 10 ); unsigned u = 10; a *= c; u *= c; CHECK( a == 100 ); CHECK( u == 100 ); CHECK( (c * c ) == 100 ); CHECK( (a * 10) == 1000 ); CHECK( (10 * a) == 1000 );
Test Result: gcc34 Passed, msvc80 Passed, msvc71 Passed
Output
Ok