aboutsummaryrefslogtreecommitdiffstats
path: root/src/floatfns.c
diff options
context:
space:
mode:
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/>. */
55 55
56#include <math.h> 56#include <math.h>
57 57
58#include <count-leading-zeros.h>
59
60/* Emacs needs proper handling of +/-inf; correct printing as well as 58/* Emacs needs proper handling of +/-inf; correct printing as well as
61 important packages depend on it. Make sure the user didn't specify 59 important packages depend on it. Make sure the user didn't specify
62 -ffinite-math-only, either directly or implicitly with -Ofast or 60 -ffinite-math-only, either directly or implicitly with -Ofast or
@@ -304,14 +302,6 @@ DEFUN ("float", Ffloat, Sfloat, 1, 1, 0,
304 return FLOATP (arg) ? arg : make_float (XFLOATINT (arg)); 302 return FLOATP (arg) ? arg : make_float (XFLOATINT (arg));
305} 303}
306 304
307static int
308ecount_leading_zeros (EMACS_UINT x)
309{
310 return (EMACS_UINT_WIDTH == UINT_WIDTH ? count_leading_zeros (x)
311 : EMACS_UINT_WIDTH == ULONG_WIDTH ? count_leading_zeros_l (x)
312 : count_leading_zeros_ll (x));
313}
314
315DEFUN ("logb", Flogb, Slogb, 1, 1, 0, 305DEFUN ("logb", Flogb, Slogb, 1, 1, 0,
316 doc: /* Returns largest integer <= the base 2 log of the magnitude of ARG. 306 doc: /* Returns largest integer <= the base 2 log of the magnitude of ARG.
317This is the same as the exponent of a float. */) 307This is the same as the exponent of a float. */)
@@ -338,7 +328,7 @@ This is the same as the exponent of a float. */)
338 EMACS_INT i = XFIXNUM (arg); 328 EMACS_INT i = XFIXNUM (arg);
339 if (i == 0) 329 if (i == 0)
340 return make_float (-HUGE_VAL); 330 return make_float (-HUGE_VAL);
341 value = EMACS_UINT_WIDTH - 1 - ecount_leading_zeros (eabs (i)); 331 value = elogb (eabs (i));
342 } 332 }
343 333
344 return make_fixnum (value); 334 return make_fixnum (value);