Date: Sat, 23 Aug 2008 17:52:21 -0700
From: "Adam R. Maxwell" <[EMAIL PROTECTED]>
Well, if your hash values collide, they collide regardless of the
hash table. As long as you've got a well-distributed hash function,
any collisions generated by the hash table implementation should be
well-distri
On Aug 23, 2008, at 5:20 PM, Peter Duniho wrote:
Date: Sat, 23 Aug 2008 12:05:44 -0700
From: "Adam R. Maxwell" <[EMAIL PROTECTED]>
[...]
Note the redundant multiply and add in the first line. Writing the
code that way makes it easy to add/remove members if for some reason
the data str
Date: Sat, 23 Aug 2008 12:05:44 -0700
From: "Adam R. Maxwell" <[EMAIL PROTECTED]>
[...]
- (BOOL)isEqual:(id)other
{
if ([other isKindOfClass:[self class]] == NO) return NO;
return ([ivar1 isEqual:(Test *)other->ivar1] && [ivar2 isEqual:
(Test *)other->ivar2]);
}
- (unsigned)hash { return [
On Aug 23, 2008, at 9:43 PM, Jeff Johnson wrote:
On Aug 23, 2008, at 2:05 PM, Adam R. Maxwell wrote:
If I have
@interface Test : NSObject
{
id ivar1;
id ivar2;
}
@end
@implementation Test
- (BOOL)isEqual:(id)other
{
if ([other isKindOfClass:[self class]] == NO) return NO;
return ([ivar
On Aug 23, 2008, at 2:05 PM, Adam R. Maxwell wrote:
If I have
@interface Test : NSObject
{
id ivar1;
id ivar2;
}
@end
@implementation Test
- (BOOL)isEqual:(id)other
{
if ([other isKindOfClass:[self class]] == NO) return NO;
return ([ivar1 isEqual:(Test *)other->ivar1] && [ivar2 isEqua
On Aug 23, 2008, at 10:26 AM, Jeff Johnson wrote:
On Aug 23, 2008, at 11:38 AM, Adam R. Maxwell wrote:
On Aug 23, 2008, at 5:13 AM, Michael Ash wrote:
On Sat, Aug 23, 2008 at 7:41 AM, Graham Cox
<[EMAIL PROTECTED]> wrote:
I have a class for which equality can be defined as having the
sam
On Aug 23, 2008, at 12:26 PM, Jeff Johnson wrote:
If you compare primitives in -isEqual:, you should combine them
(using
xor or the like) in -hash. If you compare objects by calling -
isEqual:
on them, you should combine their hashes (using xor or the like). If
you do some of each, combine th
On Aug 23, 2008, at 11:38 AM, Adam R. Maxwell wrote:
On Aug 23, 2008, at 5:13 AM, Michael Ash wrote:
On Sat, Aug 23, 2008 at 7:41 AM, Graham Cox
<[EMAIL PROTECTED]> wrote:
I have a class for which equality can be defined as having the
same internal
string value (which happens to be a UUID-t
On Aug 23, 2008, at 5:13 AM, Michael Ash wrote:
On Sat, Aug 23, 2008 at 7:41 AM, Graham Cox <[EMAIL PROTECTED]>
wrote:
I have a class for which equality can be defined as having the same
internal
string value (which happens to be a UUID-turned-string). I can easily
implement isEqual: based
On Aug 23, 2008, at 8:57 AM, Jean-Daniel Dupas wrote:
Look into the CoreFoundation sources. as Cocoa primitive are tool
free bridged, they use the same hash functions. They is even a
special case for NSString into the CFString.c file.
http://www.opensource.apple.com/darwinsource/10.5.4/CF-4
On Aug 23, 2008, at 7:41 AM, Graham Cox wrote:
I have a class for which equality can be defined as having the same
internal string value (which happens to be a UUID-turned-string). I
can easily implement isEqual: based on that but the docs say I also
need to implement -hash. Any pointers on
Le 23 août 08 à 15:39, Graham Cox a écrit :
On 23 Aug 2008, at 9:52 pm, Jean-Daniel Dupas wrote:
Le 23 août 08 à 13:41, Graham Cox a écrit :
I have a class for which equality can be defined as having the
same internal string value (which happens to be a UUID-turned-
string). I can easil
On 23 Aug 2008, at 9:52 pm, Jean-Daniel Dupas wrote:
Le 23 août 08 à 13:41, Graham Cox a écrit :
I have a class for which equality can be defined as having the same
internal string value (which happens to be a UUID-turned-string). I
can easily implement isEqual: based on that but the docs
Le 23 août 08 à 13:41, Graham Cox a écrit :
I have a class for which equality can be defined as having the same
internal string value (which happens to be a UUID-turned-string). I
can easily implement isEqual: based on that but the docs say I also
need to implement -hash. Any pointers on w
On 23 Aug 2008, at 10:13 pm, Michael Ash wrote:
On Sat, Aug 23, 2008 at 7:41 AM, Graham Cox <[EMAIL PROTECTED]>
wrote:
I have a class for which equality can be defined as having the same
internal
string value (which happens to be a UUID-turned-string). I can easily
implement isEqual: based
On Sat, Aug 23, 2008 at 7:41 AM, Graham Cox <[EMAIL PROTECTED]> wrote:
> I have a class for which equality can be defined as having the same internal
> string value (which happens to be a UUID-turned-string). I can easily
> implement isEqual: based on that but the docs say I also need to implement
On Sat, Aug 23, 2008 at 11:41 PM, Graham Cox <[EMAIL PROTECTED]> wrote:
> I have a class for which equality can be defined as having the same internal
> string value (which happens to be a UUID-turned-string). I can easily
> implement isEqual: based on that but the docs say I also need to implement
I have a class for which equality can be defined as having the same
internal string value (which happens to be a UUID-turned-string). I
can easily implement isEqual: based on that but the docs say I also
need to implement -hash. Any pointers on what is a good way to do
that? Could I just sa
18 matches
Mail list logo