Taking the question literally, that's not bitwise rotation, it's bitwise
shifting. The difference is what happens when you start shifting bits
off of one end, with shifting you lose them, with rotation they come
back in on the other end.
There is no built-in bitwise rotation operator in .NET that I'm aware
of, perhaps in 3.5 there could be something somewhere that I don't know
of, but in 2.0 I'm suspecting you have to roll your own.
This is one use case that should be implemented as a native BCL method
so that the JIT compiler could map it directly to a CPU instruction.
Another one I've been wanting is a function that counts the number set
bits in field.
Ah yes I spotted my error as soon as I hit post. I just popped back
with a proper solution but you all beat me too it
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.