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...