mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
([String -hash]): Don't use elt_* function, and use
NSHashStringLength. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@983 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
060410dfd6
commit
50d64ec469
1 changed files with 11 additions and 1 deletions
|
@ -278,7 +278,17 @@
|
|||
|
||||
- (unsigned) hash
|
||||
{
|
||||
return elt_hash_string([self cString]);
|
||||
unsigned ret = 0;
|
||||
unsigned ctr = 0;
|
||||
unsigned char_count = 0;
|
||||
const char *s = [self cStringNoCopy];
|
||||
|
||||
while (*s && char_count++ < NSHashStringLength)
|
||||
{
|
||||
ret ^= *s++ << ctr;
|
||||
ctr = (ctr + 1) % sizeof (void*);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (int) compare: anObject
|
||||
|
|
Loading…
Reference in a new issue