diff options
| author | Paul Eggert | 2011-05-03 00:51:38 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-05-03 00:51:38 -0700 |
| commit | 7fc4768c45bce52d34f183eb4734d9f58745ea3d (patch) | |
| tree | b7414afb75c1fc941f8a9dd9e6b900cbd1eb9f23 /src/bytecode.c | |
| parent | fed14fd75201f3c313293432e58de8f860979a3e (diff) | |
| download | emacs-7fc4768c45bce52d34f183eb4734d9f58745ea3d.tar.gz emacs-7fc4768c45bce52d34f183eb4734d9f58745ea3d.zip | |
Arithmetic overflows now return float rather than wrapping around.
* data.c: Include <intprops.h>.
(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.
Diffstat (limited to 'src/bytecode.c')
| -rw-r--r-- | src/bytecode.c | 6 |
1 files changed, 3 insertions, 3 deletions
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, | |||
| 1186 | { | 1186 | { |
| 1187 | Lisp_Object v1; | 1187 | Lisp_Object v1; |
| 1188 | v1 = TOP; | 1188 | v1 = TOP; |
| 1189 | if (INTEGERP (v1)) | 1189 | if (INTEGERP (v1) && MOST_NEGATIVE_FIXNUM < XINT (v1)) |
| 1190 | { | 1190 | { |
| 1191 | XSETINT (v1, XINT (v1) - 1); | 1191 | XSETINT (v1, XINT (v1) - 1); |
| 1192 | TOP = v1; | 1192 | TOP = v1; |
| @@ -1204,7 +1204,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 1204 | { | 1204 | { |
| 1205 | Lisp_Object v1; | 1205 | Lisp_Object v1; |
| 1206 | v1 = TOP; | 1206 | v1 = TOP; |
| 1207 | if (INTEGERP (v1)) | 1207 | if (INTEGERP (v1) && XINT (v1) < MOST_POSITIVE_FIXNUM) |
| 1208 | { | 1208 | { |
| 1209 | XSETINT (v1, XINT (v1) + 1); | 1209 | XSETINT (v1, XINT (v1) + 1); |
| 1210 | TOP = v1; | 1210 | TOP = v1; |
| @@ -1290,7 +1290,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 1290 | { | 1290 | { |
| 1291 | Lisp_Object v1; | 1291 | Lisp_Object v1; |
| 1292 | v1 = TOP; | 1292 | v1 = TOP; |
| 1293 | if (INTEGERP (v1)) | 1293 | if (INTEGERP (v1) && - MOST_POSITIVE_FIXNUM <= XINT (v1)) |
| 1294 | { | 1294 | { |
| 1295 | XSETINT (v1, - XINT (v1)); | 1295 | XSETINT (v1, - XINT (v1)); |
| 1296 | TOP = v1; | 1296 | TOP = v1; |