Re: right shift ops

2002-08-03 Thread John Porter
Nicholas Clark wrote: > but in the scope of use integer signed integers are used: > > $ perl -we '$a = 0xDEADBEEF; {use integer; $b = $a >> 4} printf "%08X\n%08X\n", $a, >$b' > DEADBEEF > FDEADBEE > > [Actually, IIRC it's up to the C implementation what it does, but for both > platforms I've ju

right shift ops

2002-08-03 Thread Nicholas Clark
I'm not sure what the solution to this is... If you're shifting left, there's no confusion. If you're shifting right, do you sign extend? Perl actually gives you two options - the default uses unsigned integers in C: $ perl -we '$a = 0xDEADBEEF; $b = $a >> 4; printf "%08X\n%08X\n", $a, $b' DEAD