On Fri, Nov 27, 2009 at 09:03:13AM -0600, Peter Karman wrote:

> Usually I would just change the cast to a 64-bit sized type, but as
> Obj_hash_code() is used all over the place, I'm not sure if that's the best
> solution.

I think the best solution might be to change Hash_Code() to return an i64_t.

Java's hashCode() and C#'s getHashCode() both return 32-bit values...

  http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#hashCode%28%29
  http://msdn.microsoft.com/en-us/library/system.object.gethashcode.aspx

... and that influenced the original choice, but I don't recall encountering a
fundamental reason that Hash_Code() need be 32-bit.  

Hash_Code() gets called a lot, and making it 64-bit might have a slight
negative performance impact for some 32-bit processors.  However, I think
we should be emphasizing compatibility rather than optimization for 32-bit
machines and operating systems, freeing us up to optimize for performance on
64-bit systems exclusively and reducing the number of variables we have to
bear in mind.

Marvin Humphrey

Reply via email to