unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Subject: Bug in sxhash
Date: Tue, 21 Mar 2006 17:02:09 +0100	[thread overview]
Message-ID: <m3odzzrdku.fsf@kfs-l.imdomain.dk> (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

             reply	other threads:[~2006-03-21 16:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-21 16:02 Kim F. Storm [this message]
2006-03-23 23:09 ` Bug in sxhash Richard Stallman
2006-03-24 13:29   ` Kim F. Storm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3odzzrdku.fsf@kfs-l.imdomain.dk \
    --to=storm@cua.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).