Bit scan instructions, obviously, if it doesn't need to be portable. Other than that, maybe http://webpages.charter.net/tlikens/tech/bitmaps/bit_popcnt.html … could be a source of inspiration?
-
-
-
Can you give an example for how to implement that more efficiently using bit scan instructions? I can't seem to be able to build something more efficient. (Even if I assume ctz(0)/clz(0) to be defined.)
- Show replies
New conversation -
-
-
My friend told me you can use SMT to find a minimal function bit-extensionally equal to a given function. I have no idea how, and I know you're an SMT expert already, so this is probably not helpful... but I'm curious about this use case!
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Hello, I would say that b0000 0110 is not a valid solution for your question, because the right most set of "set bits" is empty. It would be easy to present a solution based on carry chains, but I suspect this solution is intended for a processor, right? See you at FPGA Kongress.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
I defer to Knuth, 4A.7.1.3 formula 43, which suggests: x & ~[ (x|(x-1)) + 1] This is probably of the same complexity as your solution.
-
Or possibly lower complexity, I'm not sure. Is increment/decrement easier than general addition?
- Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.