mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 923328 - Ionmonkey: fix float32 hash function. r=terrence
This commit is contained in:
parent
1382b361b3
commit
e5a88dc385
@ -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…
Reference in New Issue
Block a user