From 7fc4768c45bce52d34f183eb4734d9f58745ea3d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 3 May 2011 00:51:38 -0700 Subject: Arithmetic overflows now return float rather than wrapping around. * data.c: Include . (arith_driver): Use floating point if the accumulator would otherwise go out of EMACS_INT range. (arith_driver, Fadd1, Fsub1): Use floating point if the result is out of Emacs fixnum range. * bytecode.c (exec_byte_code): Likewise, for Bsub1, Badd1, Bnegate. --- src/bytecode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/bytecode.c') diff --git a/src/bytecode.c b/src/bytecode.c index c3cd3d43072..ce79b011bbb 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -1186,7 +1186,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, { Lisp_Object v1; v1 = TOP; - if (INTEGERP (v1)) + if (INTEGERP (v1) && MOST_NEGATIVE_FIXNUM < XINT (v1)) { XSETINT (v1, XINT (v1) - 1); TOP = v1; @@ -1204,7 +1204,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, { Lisp_Object v1; v1 = TOP; - if (INTEGERP (v1)) + if (INTEGERP (v1) && XINT (v1) < MOST_POSITIVE_FIXNUM) { XSETINT (v1, XINT (v1) + 1); TOP = v1; @@ -1290,7 +1290,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, { Lisp_Object v1; v1 = TOP; - if (INTEGERP (v1)) + if (INTEGERP (v1) && - MOST_POSITIVE_FIXNUM <= XINT (v1)) { XSETINT (v1, - XINT (v1)); TOP = v1; -- cgit v1.2.1