NSUInteger hash
NSUInteger hash
- Subject: NSUInteger hash
- From: "Steve Wart" <email@hidden>
- Date: Sat, 16 Aug 2008 12:57:38 -0700
Hi all,
I'm just getting started with Cocoa and I'm trying to implement hash and
isEqual: methods according to the recommendations in the coding guidelines.
To implement a hash method I would normally just hash the receiver's
instance variables together and xor the result, but this only works if the
instance variables are objects.
However my instance variables are NSPoints, which are defined as structs,
not objects. The C programmer in me wants to cast the floats into integers
and hash those, but we are in a 64-bit world now, and I assume that 32-bit
algorithms may not give a good result.
Maybe I'm trying too hard, but it's important for what I'm doing that I
don't have a lot of collisions so I want a good quality hash function.
What's the standard way of hashing non-object values in Cocoa?
Thanks,
Steve
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden