@@ -13,10 +13,11 @@ #include #import "OFArray.h" #import "OFExceptions.h" +#import "OFMacros.h" @implementation OFArray + array { return [[[self alloc] init] autorelease]; @@ -230,11 +231,27 @@ { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; } -/* FIXME: Implement! - (uint32_t)hash { + OFObject **carray = [array cArray]; + size_t i, count = [array count]; + uint32_t hash; + + OF_HASH_INIT(hash); + + for (i = 0; i < count; i++) { + uint32_t h = [carray[i] hash]; + + OF_HASH_ADD(hash, h >> 24); + OF_HASH_ADD(hash, (h >> 16) & 0xFF); + OF_HASH_ADD(hash, (h >> 8) & 0xFF); + OF_HASH_ADD(hash, h & 0xFF); + } + + OF_HASH_FINALIZE(hash); + + return hash; } -*/ @end