[NumPy-Tickets] [NumPy] #1856: Shift operator cycles for int32 and int64

NumPy Trac numpy-tickets@scipy....
Thu Jun 2 21:21:13 CDT 2011


#1856: Shift operator cycles for int32 and int64
------------------------+---------------------------------------------------
 Reporter:  klasj       |       Owner:  somebody   
     Type:  defect      |      Status:  new        
 Priority:  normal      |   Milestone:  Unscheduled
Component:  numpy.core  |     Version:  1.6.0      
 Keywords:  shift       |  
------------------------+---------------------------------------------------

Comment(by charris):

 Looks like a compiler thing. On my fedora amd64 system


 {{{
 #include <stdio.h>

 int main(int argc, char **args)
 {
     long x = 8;

     printf("%ld\n", x << 64);

     return 0;
 }

 }}}

 gives


 {{{
 $charris@f13 ~$ ./a.out
 8
 }}}

 I suspect the problem is that 64 is equal to the register width and so a
 cyclic shift is used; the problem doesn't occur for a shift of 63. There
 is probably a compiler flag that can be used to change this...

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1856#comment:1>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list