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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to