3 ms·
That old C code relies on integer promotion to avoid the overflow problems that occurred in the m68k asm.
by fanf2 4y ago
That old C code relies on integer promotion to avoid the overflow problems that occurred in the m68k asm.
- _kst_ 4y agoExactly. C has no arithmetic operations on types narrower than int and unsigned int. This bug (which involves subtracting 8-bit values and yielding an 8-bit result) could only happen in assembly language (or in an exotic C implementation where CHAR_BIT > 8 and int is 1 byte, or in C code that uses casts to deliberately create the bug).