bitshift of integer type with K=0 does not behave as expected + patch
John W. Eaton
jwe at octave.org
Thu Mar 12 16:08:34 CDT 2009
On 12-Mar-2009, Seb Astien wrote:
| Re-sending with a patch to fix it this time.
|
| Seb.
|
| Bug report for Octave 3.0.3 configured for i686-pc-linux-gnu
|
| Description:
| -----------
|
| bitshift of uint32 value with K=0 does not behave as expected
|
|
| Repeat-By:
| ---------
|
| debug> bitshift(372607261,0,10)
| ans = 285
| debug> bitshift(uint32(372607261),0,10)
| ans = 372607261
|
|
| How to fix it
| ---------------
|
| --- liboctave/oct-inttypes.h 2009-03-12 14:01:54.000000000 +0100
| *************** bitshift (const octave_int<T>& a, int n,
| *** 556,562 ****
| else if (n < 0)
| return (a >> -n) & mask;
| else
| ! return a;
| }
|
| #define OCTAVE_INT_CMP_OP(OP) \
| --- 556,562 ----
| else if (n < 0)
| return (a >> -n) & mask;
| else
| ! return a & mask;
| }
I made this change.
Thanks,
jwe
More information about the Bug-octave
mailing list