reko
reko copied to clipboard
Reko should handle constant integer division better
The Microsoft C compiler, among others, implements divisions by constant integers C (where C is not an integral power of 2) as described in the paper Division by Invariant Integers using Multiplication. Reko fails to discover this. Thus, a simple
C
x = f / 10;
becomes
``` C
uint32 tmp = SLICE(f * ~0x33333332, word32, 32);
x = tmp >> 3;
This needs to be recognized by reko and handled better
See also #554.