mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-09 04:25:38 +00:00
Bug 923328 - Ionmonkey: fix float32 hash function. r=terrence
This commit is contained in:
parent
78ce31c17b
commit
c5c8a5b58e
@ -575,6 +575,19 @@ struct DefaultHasher<double>
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct DefaultHasher<float>
|
||||
{
|
||||
typedef float Lookup;
|
||||
static HashNumber hash(float f) {
|
||||
JS_STATIC_ASSERT(sizeof(HashNumber) == 4);
|
||||
return HashNumber(mozilla::BitwiseCast<uint32_t>(f));
|
||||
}
|
||||
static bool match(float lhs, float rhs) {
|
||||
return mozilla::BitwiseCast<uint32_t>(lhs) == mozilla::BitwiseCast<uint32_t>(rhs);
|
||||
}
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
// Both HashMap and HashSet are implemented by a single HashTable that is even
|
||||
|
Loading…
x
Reference in New Issue
Block a user