BTW, I found only one caveat in that asm-implementation: according to Intel docs target register of BSR is "undefined" if source=0, so Z-flag should always be checked after BSF/BSR. In case of "int_str" ECX randomisation after BSR surely will lead to crash, but in practice I can not reproduce such spurious behavior. --- WBR, Max.