BLI: initial hash function for Color4b and float4x4
This commit is contained in:
parent
8f6c0f2242
commit
f62204718b
|
@ -118,6 +118,12 @@ struct Color4b {
|
|||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
uint32_t hash() const
|
||||
{
|
||||
return ((uint32_t)r * 1283591) ^ ((uint32_t)g * 850177) ^ ((uint32_t)b * 735391) ^
|
||||
((uint32_t)a * 442319);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace blender
|
||||
|
|
|
@ -108,6 +108,16 @@ struct float4x4 {
|
|||
interp_m4_m4m4(result, a.values, b.values, t);
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t hash() const
|
||||
{
|
||||
uint32_t h = 435109;
|
||||
for (uint i = 0; i < 16; i++) {
|
||||
float value = ((const float *)this)[i];
|
||||
h = h * 33 + (*(uint32_t *)&value);
|
||||
}
|
||||
return h;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace blender
|
||||
|
|
Loading…
Reference in New Issue