Commit b3549359 authored by Mattias Engdegård's avatar Mattias Engdegård Committed by Paul Eggert

Fix `memql' for bignums

* src/fns.c (Fmemql): Make `memql' work for bignums.
* test/src/fns-tests.el (test-bignum-eql): Also test `memql'.
parent 57e9141a
......@@ -1567,18 +1567,32 @@ DEFUN ("memql", Fmemql, Smemql, 2, 2, 0,
The value is actually the tail of LIST whose car is ELT. */)
(Lisp_Object elt, Lisp_Object list)
{
if (!FLOATP (elt))
return Fmemq (elt, list);
Lisp_Object tail = list;
FOR_EACH_TAIL (tail)
if (FLOATP (elt))
{
Lisp_Object tem = XCAR (tail);
if (FLOATP (tem) && same_float (elt, tem))
return tail;
Lisp_Object tail = list;
FOR_EACH_TAIL (tail)
{
Lisp_Object tem = XCAR (tail);
if (FLOATP (tem) && same_float (elt, tem))
return tail;
}
CHECK_LIST_END (tail, list);
return Qnil;
}
CHECK_LIST_END (tail, list);
return Qnil;
else if (BIGNUMP (elt))
{
Lisp_Object tail = list;
FOR_EACH_TAIL (tail)
{
Lisp_Object tem = XCAR (tail);
if (equal_no_quit (elt, tem))
return tail;
}
CHECK_LIST_END (tail, list);
return Qnil;
}
else
return Fmemq (elt, list);
}
DEFUN ("assq", Fassq, Sassq, 2, 2, 0,
......
......@@ -614,7 +614,8 @@
(should (eq x x))
(should (eql x y))
(should (equal x y))
(should-not (eql x 0.0e+NaN))))
(should-not (eql x 0.0e+NaN))
(should (memql x (list y)))))
(ert-deftest test-bignum-hash ()
"Test that hash tables work for bignums."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment