summaryrefslogtreecommitdiff
path: root/src/mpfr-mini-gmp.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-08-31 15:43:48 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-08-31 15:43:48 +0000
commitebd52382c6dcfcbe17a13cb5c3c26199d2f8613c (patch)
tree97d63a7ecf105aa5832d1a8e11428123f77f9dc3 /src/mpfr-mini-gmp.c
parentabb0374b7f05425910d7e770a85e794c955dad35 (diff)
downloadmpfr-ebd52382c6dcfcbe17a13cb5c3c26199d2f8613c.tar.gz
[src/mpfr-mini-gmp.c] Fixed potential undefined behavior (when mp_limb_t
is defined as an unsigned short) with MPFR_LIMB_LSHIFT. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13102 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/mpfr-mini-gmp.c')
-rw-r--r--src/mpfr-mini-gmp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mpfr-mini-gmp.c b/src/mpfr-mini-gmp.c
index d397f0d40..70677dcfa 100644
--- a/src/mpfr-mini-gmp.c
+++ b/src/mpfr-mini-gmp.c
@@ -87,7 +87,7 @@ mpz_urandomb (mpz_t rop, gmp_randstate_t state, mp_bitcnt_t nbits)
i = n * GMP_NUMB_BITS - nbits;
/* mask the upper i bits */
if (i)
- rop->_mp_d[n-1] = MPFR_LIMB(rop->_mp_d[n-1] << i) >> i;
+ rop->_mp_d[n-1] = MPFR_LIMB_LSHIFT(rop->_mp_d[n-1], i) >> i;
while (n > 0 && (rop->_mp_d[n-1] == 0))
n--;
rop->_mp_size = n;