summaryrefslogtreecommitdiff
path: root/src/lisp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lisp.h b/src/lisp.h
index 8ee37f5298a..d61a4d5c982 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -23,6 +23,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <alloca.h>
#include <setjmp.h>
#include <stdarg.h>
+#include <stdbit.h>
#include <stdckdint.h>
#include <stddef.h>
#include <string.h>
@@ -37,7 +38,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <attribute.h>
#include <byteswap.h>
-#include <count-leading-zeros.h>
#include <intprops.h>
#include <verify.h>
@@ -4148,11 +4148,12 @@ integer_to_uintmax (Lisp_Object num, uintmax_t *n)
}
}
-/* Return floor (log2 (N)) as an int, where 0 < N <= ULLONG_MAX. */
+/* Return floor (log2 (N)) as an int. If N is zero, return -1. */
INLINE int
elogb (unsigned long long int n)
{
- return ULLONG_WIDTH - 1 - count_leading_zeros_ll (n);
+ int width = stdc_bit_width (n);
+ return width - 1;
}
/* A modification count. These are wide enough, and incremented