> Yes.
>>>does java have a bitwise rotation operator for Integers?
> ^^^^^^^^ ^^^^^^^^
[quoted text clipped - 7 lines]
>
> (i << n) | (i >>> (32 - n))
I stand correced, mis interpreted due to out of coffee error :)
>>>does java have a bitwise rotation operator for Integers?
>
[quoted text clipped - 4 lines]
>
> (i << n) | (i >>> (32 - n))
Not true in java 1.5, since there are ror/rol operations in
java.lang.Math or Integer, I can't recall which right now. Of course,
they are fairly disappointing (from a performance point of view) since
they are just wrappers that do just the above, although I suspect they
will be compiler intrinsics in later VM versions.

Signature
Daniel Sjöblom
Remove _NOSPAM to reply by mail
Eric Sosman coughed up:
>>> does java have a bitwise rotation operator for Integers?
> ^^^^^^^^ ^^^^^^^^
[quoted text clipped - 7 lines]
>
> (i << n) | (i >>> (32 - n))
For some reason, this ROR seems much more readable to me:
(i << (32-n)) | (i >>> n)
I think because it deals with the left most bit first, and I think left to
right. "Left" is highbit, because of the way you write down binary on
paper.

Signature
Iamamanofconstantsorrow,I'veseentroubleallmydays.Ibidfarewelltoold
Kentucky,TheplacewhereIwasbornandraised.ForsixlongyearsI'vebeenin
trouble,NopleasureshereonearthIfound.ForinthisworldI'mboundtoramble,
Ihavenofriendstohelpmenow....MaybeyourfriendsthinkI'mjustastrangerMyface,
you'llneverseenomore.ButthereisonepromisethatisgivenI'llmeetyouonGod's
goldenshore.
Eric Sosman - 14 Mar 2005 17:19 GMT
> Eric Sosman coughed up:
>
[quoted text clipped - 18 lines]
> right. "Left" is highbit, because of the way you write down binary on
> paper.
That's one of the reasons I wrote "something like" ;-)
My mental picture of a rotation is "shift, then replace the
bits that fell off the end." De gustibus non disputandum est.

Signature
Eric.Sosman@sun.com