On 2009-12-06 12:36:49 -0500, dsimcha <[email protected]> said:
== Quote from bearophile ([email protected])'s article
Andrei Alexandrescu:
Should we yank operator>>>?
We can change it purpose and add the other one:
<<< rotate left
rotate right
Bye,
bearophile
This is a good idea, although rotate may be seldom enough used not to
warrant its
own (possibly overloadable) operator. std.intrinsic might be a better
place for
rotate. On the other hand, rotate is a single ASM instruction, at
least on x86.
In a close to the metal language, there needs to be a straightforward,
efficient
way to access it.
The first time I searched for a way to rotate bits, I searched for an
operator and didn't find one (it was in C++ I think). So I wrote my own
function; it wasn't worth the time searching further.
I support <<< and >>> for rotate left and right, as an operator is the
most obvious place to look for such a basic operation.
--
Michel Fortin
[email protected]
http://michelf.com/