You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The decompiler already has logic for recognizing optimized division, but it seems to be missing some (newer?) forms. Working towards fixing the problem.
Using http://flaviojslab.blogspot.com/2008/02/integer-division.html as (unverified and maybe incomplete) reference, we can create the following
mult.c
sample:With a high optimization level, GCC will generate code making use of constants (in most cases):
gcc -O3 -c mult.c -o mult.o
In ghidra, this will result in functions like:
This is one I actually came across in the wild (this is the division by 100).
Ideally, these pattern should be recognized and replaced in the decompiler view.
Env: Ghidra 9.0.4, Linux x86_64, GCC 8.3.0
The text was updated successfully, but these errors were encountered: