git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Riesen <raa.lkml@gmail.com>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>,
	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 20:22:29 +0200	[thread overview]
Message-ID: <AANLkTilE7UI3zg180U9GCB6DsByu3B9pwlG6xIyR8uiG@mail.gmail.com> (raw)
In-Reply-To: <20100527180554.GM16470@spearce.org>

On Thu, May 27, 2010 at 20:05, Shawn O. Pearce <spearce@spearce.org> wrote:
> 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.

Just make sure the SHA1 data are properly aligned for your platform

  reply	other threads:[~2010-05-27 18:28 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
2010-05-27 18:22     ` Alex Riesen [this message]
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=AANLkTilE7UI3zg180U9GCB6DsByu3B9pwlG6xIyR8uiG@mail.gmail.com \
    --to=raa.lkml@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ilari.liusvaara@elisanet.fi \
    --cc=spearce@spearce.org \
    --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).