I want to create a bitmask for the most right continuous range of set bits. For example 01010110 -> 00000110. Is (x & ~(x + (x & -x))) the best way to do that or is there a better solution? #followerpower
-
-
That's what I tried. The best implementation using this scheme I came up with is this, which I do not think is more efficient, and it does not work for x=-1 if ctz(0) is undefined. http://svn.clifford.at/handicraft/2018/cbmc/lastblock.c …pic.twitter.com/rZj7zfEUzc
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
That doesn’t give a mask. You’ll still need to clear the other bits of the res2, for example, shifting it left by XLEN-res4 and then right by XLEN-res1. All of which takes five more instructions.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
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.