ObjFW  Check-in [a55371e2c9]

Overview
Comment:Improve -[OFObject hash]

This shifted the wrong way, and there's also no point in not hashing
over the entire address.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a55371e2c9e581cf005ea28b286bab3f9db3da192e37b15608a8ee77f00e7a57
User & Date: js on 2017-02-03 22:42:13
Other Links: manifest | tags
Context
2017-02-04
13:13
OFSystemInfo: Minor #ifdef cleanup check-in: feed7bc7f9 user: js tags: trunk
2017-02-03
22:42
Improve -[OFObject hash] check-in: a55371e2c9 user: js tags: trunk
22:36
OFMessagePackExtension: Only swap bytes if LE check-in: fc17e7646a user: js tags: trunk
Changes

Modified src/OFObject.m from [b658da002c] to [21ee30041a].

803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
- (uint32_t)hash
{
	uintptr_t ptr = (uintptr_t)self;
	uint32_t hash;

	OF_HASH_INIT(hash);

	while (ptr != 0) {
		OF_HASH_ADD(hash, ptr & 0xFF);
		ptr <<= 8;
	}

	OF_HASH_FINALIZE(hash);

	return hash;
}








|

|







803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
- (uint32_t)hash
{
	uintptr_t ptr = (uintptr_t)self;
	uint32_t hash;

	OF_HASH_INIT(hash);

	for (size_t i = 0; i < sizeof(ptr); i++) {
		OF_HASH_ADD(hash, ptr & 0xFF);
		ptr >>= 8;
	}

	OF_HASH_FINALIZE(hash);

	return hash;
}