/// direct method for 32-bit in dumb assembly
unsigned rbN1 (unsigned arg)
{
__asm
{
xor eax, eax // eax := 0
mov ebx, arg // ebx := arg
mov ecx, 32 // ecx := 32 // bits
NEXTBIT: // loop begin
sub ecx, 1 // --ecx
mov edx, ebx // edx := ebx // arg
and edx, 1 // edx &= 1 // zero all bits except the least one
shl edx, cl // edx <<= (char)ecx
or eax, edx // eax |= edx
shr ebx, 1 // ebx >>= 1
test ecx, ecx // if ecx ...
jnz NEXTBIT // ... != 0 then next iteration
}
// return eax
}