There is a type bug in reduce32 in reduce.c:
int32_t reduce32(int32_t a) {
int32_t t;
t = (a + (1 << 22)) >> 23;
t = a - t*Q;
return t;
}
The type of 1 is int, thus depending on the number of bits in an int (at least 16), (1 << 22) is undefined. Indeed, compiling this with SDCC, we see them both become 0, which I don't think was intended. The fix is simple: replace both 1 with 1l to change the type to long, which has at least 32 bits.
There is a type bug in
reduce32in reduce.c:The type of 1 is
int, thus depending on the number of bits in anint(at least 16),(1 << 22)is undefined. Indeed, compiling this with SDCC, we see them both become 0, which I don't think was intended. The fix is simple: replace both 1 with 1l to change the type to long, which has at least 32 bits.