// output of ./demo/bits/debruijn-lookup-demo.cc: // Description: //% Determination of the lowest bit in a word via De Bruijn sequences. db=...1.111 dbt[k]= 0 1 2 3 4 5 6 7 0 1 2 4 7 3 6 5 Lowest bit == 0: x = .......1 db * x = ...1.111 shifted = ........ == 0 ==> lookup = 0 Lowest bit == 1: x = ......1. db * x = ..1.111. shifted = .......1 == 1 ==> lookup = 1 Lowest bit == 2: x = .....1.. db * x = .1.111.. shifted = ......1. == 2 ==> lookup = 2 Lowest bit == 3: x = ....1... db * x = 1.111... shifted = .....1.1 == 5 ==> lookup = 3 Lowest bit == 4: x = ...1.... db * x = .111.... shifted = ......11 == 3 ==> lookup = 4 Lowest bit == 5: x = ..1..... db * x = 111..... shifted = .....111 == 7 ==> lookup = 5 Lowest bit == 6: x = .1...... db * x = 11...... shifted = .....11. == 6 ==> lookup = 6 Lowest bit == 7: x = 1....... db * x = 1....... shifted = .....1.. == 4 ==> lookup = 7