Small clang compatibility patch by Niels Grewe

<niels.grewe@halbordnung.de>.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29421 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2010-01-27 14:23:45 +00:00
parent 7a9c943bc4
commit 25a22d9fc9
2 changed files with 10 additions and 7 deletions

View file

@ -1265,17 +1265,14 @@ systemColorWithName(NSString *name)
- (NSUInteger) hash
{
int nums = [self numberOfComponents];
union {
uint8_t bytes[sizeof(float) * nums];
float floats[nums];
} u;
float floats[nums];
NSUInteger h = 0;
unsigned i;
[self getComponents: u.floats];
for (i = 0; i < sizeof(u); i++)
[self getComponents: &floats[0]];
for (i = 0; i < sizeof(floats); i++)
{
h = (h << 5) + h + u.bytes[i];
h = (h << 5) + h + *(uint8_t*)(((uintptr_t)&floats[0])+(i*sizeof(uint8_t)));
}
return h;
}