Mercurial > hg > octave-nkf
diff liboctave/oct-inttypes.cc @ 8864:4d328b8979c8
simplify integer power
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 25 Feb 2009 06:47:16 +0100 |
parents | ab4db66e286f |
children | eb63fbe60fab |
line wrap: on
line diff
--- a/liboctave/oct-inttypes.cc +++ b/liboctave/oct-inttypes.cc @@ -530,15 +530,14 @@ { octave_int<T> retval; - octave_int<T> zero = octave_int<T> (0); - octave_int<T> one = octave_int<T> (1); + octave_int<T> zero = static_cast<T> (0); + octave_int<T> one = static_cast<T> (1); if (b == zero || a == one) retval = one; - // the is_signed check is inserted twice to avoid compiler warnings - else if (std::numeric_limits<T>::is_signed && b < zero) + else if (b < zero) { - if (a == octave_int<int> (-1)) + if (a == -one) retval = (b.value () % 2) ? a : one; else retval = zero;