From: Paul Eggert Date: Wed, 6 Nov 2019 06:55:23 +0000 (-0800) Subject: Remove unneeded overflow check in integer division X-Git-Tag: emacs-27.0.90~724 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6039acb86113e21409dafe5ebf75d04fbe4577f6;p=emacs.git 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). --- 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, /* 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; break; case Alogand: accum &= next; continue; case Alogior: accum |= next; continue;