Public feed #532170

Unnamed

public text v1 · immutable
Raw Edit
·published 2007-06-03 02:36 UTC
rendered paste body
Implement the following in one assembly instruction::

for (ecx = 0; ecx < 32; ecx++) {
    if ((1 << ecx) & eax) {
        ebx = ecx;
    }
}

At the end, ebx is equal to the placeholder of the leftmost 1 in eax

If eax = 0011 1100  (60)
ebx =    0000 0101  (5)

If eax = 0000 1101  (13)
ebx =    0000 0011  (3)