0

A 3D software was compiled in which a typical x/4096f was translated as:

fmul    ds:f4096

where f4096 equals to: 0.00024414062

Example decompiled pseudocode as-is:

skeletonMemoryPointer[i].pos = *(skeletonPointer + 48 * i + 18) * 0.00024414062 

As we can see the * 0.00024414062 may be problematic to understand at first sight.

Expected:

skeletonMemoryPointer[i].pos = *(skeletonPointer + 48 * i + 18) / 4096.0

Is there a way I could change the pseudocode related to this variable so IDA recognizes fmul 0.00024414062 as divide by 4096.0f without physically touching the assembly?

basic 32bit calculation: 1/4096.0 = 0.000244140625

edit: or at least change the decompiler behaviour to not translate fmul ds:f4096 to const?, so the result would be :

float f_div4096 = 0.000244140625; 
skeletonMemoryPointer[i].pos = *(skeletonPointer + 48 * i + 18) * f_div4096;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.