If the input number has x bits already I'd use this way:
;Lowest bit set , if you want 128 bit math -n = ^n+1 , so carry can be n==0 test per word
b1 = n & ( -n )
;Set all trailing 0's to 1's
n1 = n | (b1-1 )
;Complement
n1 = ~n1
;Now find lowest set bit in complement ( lowest clear bit...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.