Open Bug 668315 Opened 10 years ago Updated 8 years ago

SMILIntegerType::Interpolate should use NS_lround instead of re-implementing rounding

Categories

(Core :: SVG, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

People

(Reporter: dholbert, Unassigned)

Details

SMILIntegerType::Interpolate has some manual round-to-nearest int code that I think can be replaced with a call to NS_lround().
Specifically:
86   // When currentVal is exactly midway between its two nearest integers, we
87   // jump to the "next" integer to provide simple, easy to remember and
88   // consistent behaviour (from the SMIL author's point of view).
89 
90   if (startVal < endVal) {
91     aResult.mU.mInt = int64_t(floor(currentVal + 0.5)); // round mid up
92   } else {
93     aResult.mU.mInt = int64_t(ceil(currentVal - 0.5)); // round mid down
94   }
http://mxr.mozilla.org/mozilla-central/source/content/smil/SMILIntegerType.cpp#86

Though note that NS_lround returns a 32-bit int, not a 64-bit int, so it may not be appropriate here after all.
You need to log in before you can comment on or make changes to this bug.