minor optimisation

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20097 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2004-09-20 10:10:10 +00:00
parent 4befe1dc32
commit 7de873c1d6
3 changed files with 16 additions and 5 deletions

View file

@ -1,3 +1,7 @@
2004-09-20 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSProxy.m: minor hash optimisation
2004-09-19 Adrian Robert <arobert@cogsci.ucsd.edu>
* Headers/Foundation/NSCoder.h

View file

@ -290,7 +290,14 @@ extern BOOL __objc_responds_to(id, SEL);
*/
- (unsigned int) hash
{
return (unsigned int)self;
/*
* Ideally we would shift left to lose any zero bits produced by the
* alignment of the object in memory ... but that depends on the
* processor architecture and the memory allocatiion implementation.
* In the absence of detailed information, pick a reasonable value
* assuming the object will be aligned to an eight byte boundary.
*/
return ((unsigned)self)>>3;
}
/** <init /> <override-subclass />

View file

@ -480,9 +480,9 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
*/
- (void) addInformalProtocols: (NSArray *)protocolNames
{
NSString *name;
NSString *file;
NSEnumerator *pnames = [protocolNames objectEnumerator];
NSString *name;
NSString *file;
NSEnumerator *pnames = [protocolNames objectEnumerator];
//PENDING, should we worry about not overriding entries?
while ((name = [pnames nextObject]) != nil)
@ -490,7 +490,7 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
file = [[refs objectForKey: @"category"] objectForKey: name];
if (file != nil)
{
[[refs objectForKey: @"protocol"] setObject: file forKey: name];
[[refs objectForKey: @"protocol"] setObject: file forKey: name];
}
else
{