aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorPaul Eggert2019-11-05 22:55:23 -0800
committerPaul Eggert2019-11-05 22:55:51 -0800
commit6039acb86113e21409dafe5ebf75d04fbe4577f6 (patch)
tree3251440b7a22b99506c25a6dde248e0245ca90a0 /src/data.c
parent0661a39d1b501a41e439df8c73f7b7f3bf3e3761 (diff)
downloademacs-6039acb86113e21409dafe5ebf75d04fbe4577f6.tar.gz
emacs-6039acb86113e21409dafe5ebf75d04fbe4577f6.zip
Remove unneeded overflow check in integer division
* src/data.c (arith_driver): Remove unnecessary runtime test, since integer overflow is impossible on division of fixnums, given that the worst case is MOST_NEGATIVE_FIXNUM / -1 which is representable as an EMACS_INT (albeit not as a fixnum).
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/data.c b/src/data.c
index d968ac9e3a9..955e5073900 100644
--- a/src/data.c
+++ b/src/data.c
@@ -2944,7 +2944,7 @@ arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args,
2944 /* Set ACCUM to the next operation's result if it fits, 2944 /* Set ACCUM to the next operation's result if it fits,
2945 else exit the loop. */ 2945 else exit the loop. */
2946 bool overflow = false; 2946 bool overflow = false;
2947 intmax_t a UNINIT; 2947 intmax_t a;
2948 switch (code) 2948 switch (code)
2949 { 2949 {
2950 case Aadd : overflow = INT_ADD_WRAPV (accum, next, &a); break; 2950 case Aadd : overflow = INT_ADD_WRAPV (accum, next, &a); break;
@@ -2953,9 +2953,8 @@ arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args,
2953 case Adiv: 2953 case Adiv:
2954 if (next == 0) 2954 if (next == 0)
2955 xsignal0 (Qarith_error); 2955 xsignal0 (Qarith_error);
2956 overflow = INT_DIVIDE_OVERFLOW (accum, next); 2956 eassert (! INT_DIVIDE_OVERFLOW (accum, next));
2957 if (!overflow) 2957 a = accum / next;
2958 a = accum / next;
2959 break; 2958 break;
2960 case Alogand: accum &= next; continue; 2959 case Alogand: accum &= next; continue;
2961 case Alogior: accum |= next; continue; 2960 case Alogior: accum |= next; continue;