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

How about <<< and >>> ops?

Thread Next
From:
John L. Allen
Date:
January 22, 2001 09:32
Subject:
How about <<< and >>> ops?
Message ID:
Pine.SOL.3.91.1010122123125.2386A-100000@gateway.grumman.com

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?

John.


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About