1 2 3 4 5 6 7 8 9 10 11 12 13 14
/// direct method: "stack", mb shortest code unsigned rbN5 (unsigned arg) { __asm { mov edx, arg mov ecx, 32 NEXTBIT: shr edx, 1 // pop cf from edx rcl eax, 1 // push cf into eax loop NEXTBIT // sub ecx, 1 + jnz NEXTBIT will be faster } }