git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Cc: Vicent Marti <tanoku@gmail.com>,
	git@vger.kernel.org, srabbelier@gmail.com
Subject: Re: Libgit2 on the Summer of Code
Date: Thu, 27 May 2010 11:05:54 -0700	[thread overview]
Message-ID: <20100527180554.GM16470@spearce.org> (raw)
In-Reply-To: <20100527174636.GB9909@LK-Perkele-V2.elisa-laajakaista.fi>

Ilari Liusvaara <ilari.liusvaara@elisanet.fi> wrote:
> * Where algorithm in git_revpool_table__hash() is from? Since it appears to
> hash binary object IDs, wouldn't just simple sum/xor over words be sufficient
> (all SHA-1 output bits are very nearly independent). Or do you need to be
> compatible with some other implementation (doesn't appear so, because hash
> is computed differently depending on endianess)?

If you need a hash value for a SHA-1, why not just cast the unsigned
char* to unsigned int* and load the first int as the hash code?
The output of SHA-1 is pretty evenly distributed, using the first
few bytes as an int should yield a sufficient distribution throughout
the hashtable.
 
-- 
Shawn.

  reply	other threads:[~2010-05-27 18:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-27 16:25 Libgit2 on the Summer of Code Vicent Marti
2010-05-27 17:46 ` Ilari Liusvaara
2010-05-27 18:05   ` Shawn O. Pearce [this message]
2010-05-27 18:22     ` Alex Riesen
2010-06-02 18:42       ` Junio C Hamano
2010-05-27 18:35     ` Ilari Liusvaara
2010-05-28  0:15       ` Vicent Marti

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

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

  git send-email \
    --in-reply-to=20100527180554.GM16470@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=ilari.liusvaara@elisanet.fi \
    --cc=srabbelier@gmail.com \
    --cc=tanoku@gmail.com \
    /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.
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 NNTP newsgroup(s).