May 7, 2021, 5:11:26 AM5/7/21
>> bool signChange = ((left + right) ^ left) >> 31;
> This is presumably missing the casts to uint32_t. As it stands, you
> have a recursive loop.
No, the values should remain signeds to result -1 or 0,
converted to truw or fase.
>> bool carry = (uint32_t)left + (uint32_t)right <
>> bool overflow = signChange & !carry;
>> if( overflow )
>> throw range_error( "bint32_t add-overflow" );
>> return left.m_value + right.m_value;
> The class you gave earlier was buint32_t, with the underlying type being
> unsigned (uint32_t). Now you have switched to bint32_t, but it is not
> clear if your underlying arithmetic is done using signed or unsigned types.
I just wanted to give an exampe how a oveflow-test would look like
for a signed version of my class.