([NSString -hash]): Don't use elt_* function, and use

NSHashStringLength.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@984 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Andrew McCallum 1996-02-22 21:50:35 +00:00
parent 50d64ec469
commit 43b2e0f097

View file

@ -572,8 +572,17 @@ handle_printf_atsign (FILE *stream,
- (unsigned int) hash
{
/* xxx need to use NSHashStringLength. */
return elt_hash_string([self _cStringContents]);
unsigned ret = 0;
unsigned ctr = 0;
unsigned char_count = 0;
const char *s = [self _cStringContents];
while (*s && char_count++ < NSHashStringLength)
{
ret ^= *s++ << ctr;
ctr = (ctr + 1) % sizeof (void*);
}
return ret;
}
- (BOOL) isEqual: (id)anObject