14 ms·
It's not. 0x8000 is the smallest (-32,768) integer that can be represented with 16-bits and two's complement.
by mbel 3y ago
It's not. 0x8000 is the smallest (-32,768) integer that can be represented with 16-bits and two's complement.
- taeric 3y agoYeah, I think it is funny that in a standard binary, it would replace negative zero and makes some sense. In two's complement, it replaces the minimum value. Fair that sentinel value is sentinel value, I suppose. But it is not like it is not a known and unique number in that encoding.
- pornel 3y agoabs() of this value also happens to exceed the maximum positive value. Which means that in C, a simple negation can cause signed integer overflow -(-32768), and therefore UB.