Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reko should handle constant integer division better #63

Open
uxmal opened this issue Sep 22, 2015 · 1 comment
Open

Reko should handle constant integer division better #63

uxmal opened this issue Sep 22, 2015 · 1 comment
Labels
enhancement This is a feature request

Comments

@uxmal
Copy link
Owner

uxmal commented Sep 22, 2015

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 uxmal added the enhancement This is a feature request label Sep 23, 2015
@rfalke
Copy link

rfalke commented Sep 8, 2021

See also #554.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is a feature request
Projects
None yet
Development

No branches or pull requests

2 participants