Tag Archives: bit

The “C” preprocessor: not as cryptic as you’d think

The C preprocessor is a modest macro-expansion language (check out “m4” if you want to see an immodest one).  Basic symbols and function-macros are convenient for giving meaningful names to constants and tiny function calls, with the rewarding feeling that … Continue reading

Posted in bit shift, preprocessor | Tagged , , , , , , | 6 Comments

The Generic SSE2 Loop

In response to a couple of comments on my post about find-first-bit-set in SSE2 registers, amounting to “what use is a routine that only does 16-byte bitvecs”, I thought I’d post the canonic, generic loop through memory using SSE2 ops. … Continue reading

Posted in ffs, SSE2, Uncategorized | Tagged , , , , | 5 Comments

SSE2 bit trick: ffs/fls for XMM registers

For the full “C” code that uses this idea for an arbitrary-length byte vector, see this later blog post In a discussion about all the wonderful uses of the combination movemask(pcmpxx(a,b)), it occurred to me that this gives you a … Continue reading

Posted in Uncategorized | Tagged , , , , , | Leave a comment