From: Junio C Hamano <gitster@pobox.com>
To: Alex Riesen <raa.lkml@gmail.com>
Cc: "Shawn O. Pearce" <spearce@spearce.org>,
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: Wed, 02 Jun 2010 11:42:21 -0700 [thread overview]
Message-ID: <7vvda1cm42.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <AANLkTilE7UI3zg180U9GCB6DsByu3B9pwlG6xIyR8uiG@mail.gmail.com> (Alex Riesen's message of "Thu\, 27 May 2010 20\:22\:29 +0200")
Alex Riesen <raa.lkml@gmail.com> writes:
> 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
Also I'd prefer to see the code watch out for reproducibility across
platforms with different endianness and integer size.
next prev parent reply other threads:[~2010-06-02 18:42 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
2010-06-02 18:42 ` Junio C Hamano [this message]
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=7vvda1cm42.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=ilari.liusvaara@elisanet.fi \
--cc=raa.lkml@gmail.com \
--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).