# HG changeset patch # User Jaroslav Hajek # Date 1235540836 -3600 # Node ID 4d328b8979c80f738b376ccf24409a76549dab3f # Parent 34a8218549610c6adb5e1ddeddd3f24d6f5b5b94 simplify integer power diff -r 34a821854961 -r 4d328b8979c8 liboctave/ChangeLog --- a/liboctave/ChangeLog Wed Feb 25 00:41:40 2009 -0500 +++ b/liboctave/ChangeLog Wed Feb 25 06:47:16 2009 +0100 @@ -1,3 +1,8 @@ +2009-02-25 Jaroslav Hajek + + * oct-inttypes.cc (pow (const octave_int&, const octave_int&)): + Simplify. + 2009-02-23 Jaroslav Hajek * oct-inttypes.h (octave_int_cmp_op::mop): Implement as simple diff -r 34a821854961 -r 4d328b8979c8 liboctave/oct-inttypes.cc --- a/liboctave/oct-inttypes.cc Wed Feb 25 00:41:40 2009 -0500 +++ b/liboctave/oct-inttypes.cc Wed Feb 25 06:47:16 2009 +0100 @@ -530,15 +530,14 @@ { octave_int retval; - octave_int zero = octave_int (0); - octave_int one = octave_int (1); + octave_int zero = static_cast (0); + octave_int one = static_cast (1); if (b == zero || a == one) retval = one; - // the is_signed check is inserted twice to avoid compiler warnings - else if (std::numeric_limits::is_signed && b < zero) + else if (b < zero) { - if (a == octave_int (-1)) + if (a == -one) retval = (b.value () % 2) ? a : one; else retval = zero;