Please note: We are aware of an issue affecting replies on the Arm Community forums, which may not be loading as expected.

We apologize for any inconvenience and appreciate your patience while we investigate and work to resolve the issue.

Thank you for your understanding.


This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

algorithm for 32bit division in c

I got below code form forum For multiplication of 24bit*8bit,the result which is a 32bit value has to be divided by 32bit constant,but i don't know algorithm used here for 32bit division so pls help me with algoritm
unsigned long s, e, w, k;

s = 0x000F4240;
k = 0;
e = read_val1;
e = (e << 8) | read_val2;
e = (e << 8) | read_val3;
e *= 0x10;

do {

w = e - s;

if (w < 0)

goto endit;

s >>= 1; : :
} while ((s & 0x80000000) == 0);
: :
endit:

Parents Reply Children
No data