develooper Front page | perl.perl5.porters | Postings from June 2015

Re: Coverity finding: shift by negative

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
June 23, 2015 01:10
Subject:
Re: Coverity finding: shift by negative
Message ID:
5588B1F2.1030100@iki.fi
On Monday-201506-22 20:58, Jan Dubois wrote:
> Surely a right shift by too many bits should result in 0.

Well, duh, I forgot the most obvious option :-)

> I'm less sure about the left shift, but I think I would rather see the
> far left bits dropped.

Zero also for overly-left-shift would be at least logical.  For UV (the 
default case), that is.  For 'use integer' (which is signed ints), 
umm... yeah, gets funky for the negatives.

How do our "high-level" neighbors do?  Python, Ruby?



Thread Previous | 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