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

Re: Coverity finding: shift by negative

Thread Previous | Thread Next
From:
H.Merijn Brand
Date:
June 23, 2015 10:43
Subject:
Re: Coverity finding: shift by negative
Message ID:
20150623124303.152980c1@pc09.procura.nl
On Mon, 22 Jun 2015 17:58:46 -0700, Jan Dubois <jand@activestate.com>
wrote:

> > shift by too many bits == shift by n modulo wordbits?
> > (with a sane definition of modulo for negative -n...)  
> 
> Surely a right shift by too many bits should result in 0.
> I'm less sure about the left shift, but I think I would rather see the
> far left bits dropped.

 >> → 0
 << → NaN ?

-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.21   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/

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