From c7e393bc4130c871a92fef7e9ac0c7c1832aa614 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 6 Jul 2018 23:44:30 -0600 Subject: [PATCH] Make lognot handle bignums * src/data.c (Flognot): Handle bignums. --- src/data.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/data.c b/src/data.c index d7175683c89..c9504694e37 100644 --- a/src/data.c +++ b/src/data.c @@ -3306,8 +3306,20 @@ DEFUN ("lognot", Flognot, Slognot, 1, 1, 0, doc: /* Return the bitwise complement of NUMBER. NUMBER must be an integer. */) (register Lisp_Object number) { - CHECK_FIXNUM (number); - XSETINT (number, ~XINT (number)); + CHECK_INTEGER (number); + if (BIGNUMP (number)) + { + mpz_t value; + mpz_init (value); + mpz_com (value, XBIGNUM (number)->value); + number = make_number (value); + mpz_clear (value); + } + else + { + eassume (FIXNUMP (number)); + XSETINT (number, ~XINT (number)); + } return number; } -- 2.39.2