mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
([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:
parent
50d64ec469
commit
43b2e0f097
1 changed files with 11 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue