|
|
|
|
|
by userbinator
248 days ago
|
|
That is extremely clever (how did you come up with it?), but definitely needs more than 3 instructions (you need at least 2 just to shift the constant): mov eax, 0x2020c6
shr eax, cl
mov cl, al
shl eax, cl
shr eax, 27
Yet those 14 bytes definitely beats my first attempt... although I've since found an even shorter solution: mov ax, 0x4681
lea ecx, [ecx+ecx*2]
shr eax, cl
and eax, 7
12 bytes. |
|
lzcnt ecx,ecx
mov eax, 00100 0011 0010 0000 0001b shl ecx,2 shrx eax,eax,ecx and eax,15