Bug 1249212 part 2 - Fix infinity handling in StickyTimeDurationValueCalculator::Multiply; r=froydnj

This patch brings the behavior of this method into line with the comment that
describes it and other methods in this class that have a similar test.

I discovered this bug while exercising this code from animation code and was
getting test failures due to returning -Infinity instead of the expected
Infinity.
This commit is contained in:
Brian Birtles 2016-02-19 08:37:31 +09:00
parent ca5d66e903
commit bc7586045e

View File

@ -159,7 +159,7 @@ StickyTimeDurationValueCalculator::Multiply<int64_t>(int64_t aA,
// return -Forever if the signs differ, or +Forever otherwise.
if (aA == INT64_MAX || aA == INT64_MIN ||
aB == INT64_MAX || aB == INT64_MIN) {
return (aA >= 0) ^ (aB >= 0) ? INT64_MAX : INT64_MIN;
return (aA >= 0) ^ (aB >= 0) ? INT64_MIN : INT64_MAX;
}
return aA * aB;
@ -177,7 +177,7 @@ StickyTimeDurationValueCalculator::Multiply<double>(int64_t aA, double aB)
// +/-Forever or +/-Infinity, then return -Forever if the signs differ,
// or +Forever otherwise.
if (aA == INT64_MAX || aA == INT64_MIN || IsInfinite(aB)) {
return (aA >= 0) ^ (aB >= 0.0) ? INT64_MAX : INT64_MIN;
return (aA >= 0) ^ (aB >= 0.0) ? INT64_MIN : INT64_MAX;
}
return aA * aB;