Talk:Find first set

Pseudocode verification
In addition to being based closely on the cited sources, I wrote the following C code (requires gcc) to exhaustively verify the given pseudocode in this article over the 32-bit integers:
 * 1) include 
 * 2) include 
 * 3) include 

int myffs (unsigned int x) { if (x == 0) return 0; unsigned int t = 1; unsigned int r = 1; while ((t & x) == 0) { t = t << 1; r = r + 1; }   return r; }

int table[1 << table_bits]; int myffs_table (unsigned int x) { if (x == 0) return 0; unsigned int y = x;   unsigned int r = 0; while (1) { if (y & ((1 < algorithm finds the position of the left-most set bit from the right counting from 0; or in other words  . I came across this realization, while testing that implementation. I have not tried other algorithms, but I suspect there might be a similar issue with others. I'll work on a fix, and will make an edit soon Wisp Valve (talk) 13:35, 1 September 2023 (UTC)
 * 1) define table_bits 8


 * inhibits the expected behavior, while    inhibits the same behavior as  . It was compared to `__builtin_clz` from GCC.
 * @Sbalfour, thoughts? Wisp Valve (talk) 14:18, 1 September 2023 (UTC)