summaryrefslogtreecommitdiff
path: root/src/floatfns.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2023-05-14 18:51:24 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2023-05-14 19:28:13 -0700
commit0f5b1fcdf0be8c1b3084518f1c4f6f375828094b (patch)
treeecd95c49031b77dcbce4922b5f71e87c6f3f2d0c /src/floatfns.c
parent3cd8ce87d298c3e0ca1e2336400d06c1a8794381 (diff)
downloademacs-0f5b1fcdf0be8c1b3084518f1c4f6f375828094b.tar.gz
Help GCC compute modiff_incr
* src/floatfns.c: Don’t include count-leading-zeros.h, since we no longer use it directly. (ecount_leading_zeros): Remove. (Flogb): Use elogb instead of doing it by hand. * src/lisp.h: Include count-leading-zeros.h. (elogb): New macro. (modiff_incr): Use it so that on typical platforms we use a hardware instruction instead of a loop.
Diffstat (limited to 'src/floatfns.c')
-rw-r--r--src/floatfns.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/floatfns.c b/src/floatfns.c
index 13f0ca3e129..e40364f8188 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -55,8 +55,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <math.h>
-#include <count-leading-zeros.h>
-
/* Emacs needs proper handling of +/-inf; correct printing as well as
important packages depend on it. Make sure the user didn't specify
-ffinite-math-only, either directly or implicitly with -Ofast or
@@ -304,14 +302,6 @@ DEFUN ("float", Ffloat, Sfloat, 1, 1, 0,
return FLOATP (arg) ? arg : make_float (XFLOATINT (arg));
}
-static int
-ecount_leading_zeros (EMACS_UINT x)
-{
- return (EMACS_UINT_WIDTH == UINT_WIDTH ? count_leading_zeros (x)
- : EMACS_UINT_WIDTH == ULONG_WIDTH ? count_leading_zeros_l (x)
- : count_leading_zeros_ll (x));
-}
-
DEFUN ("logb", Flogb, Slogb, 1, 1, 0,
doc: /* Returns largest integer <= the base 2 log of the magnitude of ARG.
This is the same as the exponent of a float. */)
@@ -338,7 +328,7 @@ This is the same as the exponent of a float. */)
EMACS_INT i = XFIXNUM (arg);
if (i == 0)
return make_float (-HUGE_VAL);
- value = EMACS_UINT_WIDTH - 1 - ecount_leading_zeros (eabs (i));
+ value = elogb (eabs (i));
}
return make_fixnum (value);