I'm faced with having to do a bsf (find the first bit set) in a 512bits bitmap. This is in the hot path so I'd like to see how I can speed things up.Right now I'm maintaining a header entry to know in which 32bits block the first set bit will be found. By doing a bsf on the header + a bsf in the entry designed by the header and some arithmetic, one can can compute the bsf of the whole bitmap fairly fast.But this obvious require to maintain the header in addition of the bitmap itself. I'd like to explore alternative. Notably, SSE or AVX, but failed to come up with a solution.Is that possible at all ? If yes, how ?
Can SSE (or AVX) be used to do large bsf?
performance;assembly