3 ms·
I once worked with a 16-bit processor that used two's complement with the convention — fortunately mostly just a convention — that 0x8000 was an undefined reser
by kps 5y ago
I once worked with a 16-bit processor that used two's complement with the convention — fortunately mostly just a convention — that 0x8000 was an undefined reserved value, rather than −32768. I say ‘fortunately’ because I was tasked with implementing C-style 16- and 32-bit arithmetic, where 0x8000 is perfectly reasonable as an unsigned value and perfectly reasonable as either half of a long. And ‘mostly’ because the hardware multiply instruction took two 16-bit signed operands and produced a 30 bit result.