Commit 6039acb8 authored by Paul Eggert's avatar Paul Eggert

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).
parent 0661a39d
Pipeline #3949 failed with stage
in 63 minutes and 14 seconds
......@@ -2944,7 +2944,7 @@ arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args,
/* Set ACCUM to the next operation's result if it fits,
else exit the loop. */
bool overflow = false;
intmax_t a UNINIT;
intmax_t a;
switch (code)
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,
case Adiv:
if (next == 0)
xsignal0 (Qarith_error);
overflow = INT_DIVIDE_OVERFLOW (accum, next);
if (!overflow)
a = accum / next;
eassert (! INT_DIVIDE_OVERFLOW (accum, next));
a = accum / next;
case Alogand: accum &= next; continue;
case Alogior: accum |= next; continue;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment