# HG changeset patch # User dbateman # Date 1182970979 0 # Node ID 2a83fce5a09737534d070145b1db9ba647c75aec # Parent 958713bc465e40fd2b786ab46bb83eb820a39b5f [project @ 2007-06-27 19:02:59 by dbateman] diff -r 958713bc465e -r 2a83fce5a097 liboctave/ChangeLog --- a/liboctave/ChangeLog Wed Jun 27 18:34:13 2007 +0000 +++ b/liboctave/ChangeLog Wed Jun 27 19:02:59 2007 +0000 @@ -1,3 +1,10 @@ +2007-06-04 David Bateman + + * oct-inttypes.h (octave_int& operator <<= (const T2&), + octave_int& operator >>= (const T2&)): Make shift operators + perform a twos complement arithmetic shift for both signed and + unsigned integers regardless of compiler implementations. + 2007-06-13 Michael Goffioul * SparseCmplxQR.cc (OCTAVE_C99_ZERO): For CXSparse 2.2 and greater diff -r 958713bc465e -r 2a83fce5a097 liboctave/oct-inttypes.h --- a/liboctave/oct-inttypes.h Wed Jun 27 18:34:13 2007 +0000 +++ b/liboctave/oct-inttypes.h Wed Jun 27 19:02:59 2007 +0000 @@ -295,14 +295,17 @@ template octave_int& operator <<= (const T2& x) { - ival = ((ival << x) > std::numeric_limits::max ()) ? 0 : (ival << x); + ival = ival << x; return *this; } template octave_int& operator >>= (const T2& x) { - ival >>= x; + if (ival < 0) + ival = - (((-ival) >> x) & std::numeric_limits::max()); + else + ival = ival >> x; return *this; }