зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1534156 - Get around int32_t to float rounding error. r=bryce
float(INT32_MAX); gets compiled into 2.14748365E+9 using clang, which is slightly bigger than INT32_MAX, as such 2.14748365E+9 <= INT32_MAX will return true (as INT32_MAX gets converted to a float) Differential Revision: https://phabricator.services.mozilla.com/D29464 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
64306c8162
Коммит
8926b1a54d
|
@ -534,7 +534,9 @@ class SPSNALIterator {
|
|||
|
||||
static int32_t ConditionDimension(float aValue) {
|
||||
// This will exclude NaNs and too-big values.
|
||||
if (aValue > 1.0 && aValue <= INT32_MAX) return int32_t(aValue);
|
||||
if (aValue > 1.0 && aValue <= INT32_MAX / 2) {
|
||||
return int32_t(aValue);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче