reko icon indicating copy to clipboard operation
reko copied to clipboard

Reko should handle constant integer division better

Open uxmal opened this issue 10 years ago • 1 comments

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

uxmal avatar Sep 22 '15 21:09 uxmal

See also #554.

rfalke avatar Sep 08 '21 21:09 rfalke