all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Bug in sxhash
@ 2006-03-21 16:02 Kim F. Storm
  2006-03-23 23:09 ` Richard Stallman
  0 siblings, 1 reply; 3+ messages in thread
From: Kim F. Storm @ 2006-03-21 16:02 UTC (permalink / raw)



Is sxhash really supposed to ignore the cdr of a cons?

(sxhash '(a . 1))  => 57
(sxhash '(a . 2))  => 57
(sxhash '(a . 3))  => 57

It works ok for lists:

(sxhash '(a 1))  => 913
(sxhash '(a 2))  => 914
(sxhash '(a 3))  => 915


Below is a proposed patch which gives this result:

(sxhash '(a . 1))  => 913
(sxhash '(a . 2))  => 914
(sxhash '(a . 3))  => 915

[i.e. there is no difference between lists and cons,
but at least it isn't completely stupid]


*** fns.c	06 Feb 2006 18:21:46 +0100	1.407
--- fns.c	21 Mar 2006 16:57:07 +0100	
***************
*** 5114,5119 ****
--- 5114,5125 ----
  	hash = SXHASH_COMBINE (hash, hash2);
        }
  
+   if (!NILP (list))
+     {
+       unsigned hash2 = sxhash (list, depth + 1);
+       hash = SXHASH_COMBINE (hash2, hash);
+     }
+ 
    return hash;
  }
  

--
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-03-24 13:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-21 16:02 Bug in sxhash Kim F. Storm
2006-03-23 23:09 ` Richard Stallman
2006-03-24 13:29   ` Kim F. Storm

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.