Slight performance improvement (better hash), plus tweaks for 64bit processors

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20275 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2004-10-31 13:02:58 +00:00
parent 178c64a8a5
commit 7c7c90b89c
2 changed files with 15 additions and 12 deletions

View file

@ -3,6 +3,9 @@
* Source/NSUserDefaults.m: ([setObject:forKey:]) when given a nil
value to set, remove any existing object for the key. Fix for
MacOS-X compatibility (bug #10743).
* Source/Additions/GSXML.m: Tweaks for 64-bit processors where
sizeof int is not sizeof void*
Minor optimisaion ... improve hash values.
2004-10-29 Matt Rice <ratmice@yahoo.com>

View file

@ -219,14 +219,14 @@ static NSMapTable *attrNames = 0;
{
NSMapEnumerator enumerator;
NSString *val;
int key;
void *key;
enumerator = NSEnumerateMapTable(attrNames);
while (NSNextMapEnumeratorPair(&enumerator, (void**)&key, (void**)&val))
while (NSNextMapEnumeratorPair(&enumerator, &key, (void**)&val))
{
if ([desc isEqual: val] == YES)
{
return key;
return (int)key;
}
}
return -1;
@ -391,7 +391,7 @@ static NSMapTable *attrNames = 0;
- (unsigned) hash
{
return (unsigned)lib;
return (((unsigned)lib) >> 3);
}
- (id) init
@ -568,14 +568,14 @@ static NSMapTable *nsNames = 0;
{
NSMapEnumerator enumerator;
NSString *val;
int key;
void *key;
enumerator = NSEnumerateMapTable(nsNames);
while (NSNextMapEnumeratorPair(&enumerator, (void**)&key, (void**)&val))
while (NSNextMapEnumeratorPair(&enumerator, &key, (void**)&val))
{
if ([desc isEqual: val] == YES)
{
return key;
return (int)key;
}
}
return -1;
@ -594,7 +594,7 @@ static NSMapTable *nsNames = 0;
- (unsigned) hash
{
return (unsigned)lib;
return (((unsigned)lib) >> 3);
}
/**
@ -795,14 +795,14 @@ static NSMapTable *nodeNames = 0;
{
NSMapEnumerator enumerator;
NSString *val;
int key;
void *key;
enumerator = NSEnumerateMapTable(nodeNames);
while (NSNextMapEnumeratorPair(&enumerator, (void**)&key, (void**)&val))
while (NSNextMapEnumeratorPair(&enumerator, &key, (void**)&val))
{
if ([desc isEqual: val] == YES)
{
return key;
return (int)key;
}
}
return -1;
@ -1053,7 +1053,7 @@ static NSMapTable *nodeNames = 0;
- (unsigned) hash
{
return (unsigned)lib;
return (((unsigned)lib) >> 3);
}
- (id) init