[Freeipa-devel] [PATCH] Improvements to collection API

John Dennis jdennis at redhat.com
Thu Jul 16 17:45:37 UTC 2009


On 06/29/2009 06:34 PM, Dmitri Pal wrote:
> By the way the dhash.c has a bug in this code (line 131).
> The value of h in the result of the hashing of a string will always be 0
> since h is initialized to 0 and then multiplied.

No, the expression is:

h = h * PRIME_1 ^ (*k - ' ');

which has 3 expressions:

h * PRIME_1
*k - ' '
and the exclusive-or of the two above expressions

on the first iteration h is zero and the expression h * PRIME_1 
evaluates to zero, but then that is exclusive-or'ed with *k - ' ' which 
is then assigned to h.

-- 
John Dennis <jdennis at redhat.com>

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/




More information about the Freeipa-devel mailing list