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:
CaS 2004-10-31 13:02:58 +00:00
parent c8aae944a4
commit 3294ed0aab
2 changed files with 15 additions and 12 deletions

View file

@ -3,6 +3,9 @@
* Source/NSUserDefaults.m: ([setObject:forKey:]) when given a nil * Source/NSUserDefaults.m: ([setObject:forKey:]) when given a nil
value to set, remove any existing object for the key. Fix for value to set, remove any existing object for the key. Fix for
MacOS-X compatibility (bug #10743). 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> 2004-10-29 Matt Rice <ratmice@yahoo.com>

View file

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