3 ms·
Why? If we define zero as 0xFFFF it will saturate by rolling over the first bit, which increment will not change?
by kevmo314 2y ago
Why? If we define zero as 0xFFFF it will saturate by rolling over the first bit, which increment will not change?
- NobodyNada 2y agoI don't understand what you mean. Decrementing from 0 gives you 0xFFFF, incrementing from 0xFFFF gives you zero. (It doesn't matter whether you use unsigned or signed increment as those are the same operation, at least on a two's-complement processor, where the bit pattern 0xFFFF represents -1.) You could do this trick on a machine that uses signed-magnitude representation, since a signed increment of 0xFFFF (INT_MIN) would result in 0xFFFE (INT_MIN + 1). But all modern processors use two's complement.