Okay, this maybe a dumb question. But, here it goes.
If i assign a negative value to an unsigned integral type in C++ like "unsigned short a = -1".
The value of a in the above example is set to be 65535 (2^16 - 1). And i know that if i set a value out of range to an unsigned integer, the value set will be the modulo of the number with the max size storable (65536 in this case), can you please explain the math being worked out behind the scenes?
How is (-1) modulo 65536 = 65535 ? Shouldn't it be -1 itself?