diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-08-07 07:56:08 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-08-07 07:56:08 +0000 |
commit | 9022f9b09702fd8adb1d576eebd7687edeceda14 (patch) | |
tree | 062ae3e68d382b849d0bc2bd9d66677524201813 | |
parent | 5ed8da0f717a1febc7cc83300cbb58db71c259eb (diff) | |
download | mpfr-9022f9b09702fd8adb1d576eebd7687edeceda14.tar.gz |
Avoid a potential overflow.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2391 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | ui_pow_ui.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ui_pow_ui.c b/ui_pow_ui.c index d04852704..b8a512fb4 100644 --- a/ui_pow_ui.c +++ b/ui_pow_ui.c @@ -1,6 +1,6 @@ /* mpfr_ui_pow_ui -- compute the power beetween two machine integer -Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -20,6 +20,7 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" #include "mpfr-impl.h" @@ -63,7 +64,7 @@ mpfr_ui_pow_ui (mpfr_ptr x, unsigned long int y, unsigned long int n, if (mpfr_mul (res, res, res, GMP_RNDU)) inexact = 1; err++; - if (n & (1 << i)) + if (n & (1UL << i)) if (mpfr_mul_ui (res, res, y, GMP_RNDU)) inexact = 1; } |