develooper Front page | perl.perl5.porters | Postings from January 2001

How about <<< and >>> ops?

Thread Next
John L. Allen
January 22, 2001 09:32
How about <<< and >>> ops?
Message ID:

This has probably come up before, but I think it would be good if perl
had two additional arithemetic operators:

	>>>	would be a right shift _without_ sign extension
		under use integer (currently, under use integer,
		>> is at the mercy of the underlying C lib).
	<<<	would be a left roll ($x <<< $y would be equivalent
		to ( ($x << $y) | (2**$y-1) & ($x >> (32-$y)) )
these two ops would come in handy when implementing cryptographic
algorithms.  I guess you could argue that >>> should be a right roll,
but then I don't see a good way to get >> not to sign extend under
use integer, other than making it _never_ sign extend.

There is probably some aberrent code that adding these ops would break,
but I think it would be worth it.

Any comments?


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About