[webkit-reviews] review granted: [Bug 130947] [iOS] Fix remaining misuses of abs() and fabsf() : [Attachment 228131] Patch v1

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Mar 30 16:19:15 PDT 2014


Brent Fulgham <bfulgham at webkit.org> has granted David Kilzer (:ddkilzer)
<ddkilzer at webkit.org>'s request for review:
Bug 130947: [iOS] Fix remaining misuses of abs() and fabsf()
https://bugs.webkit.org/show_bug.cgi?id=130947

Attachment 228131: Patch v1
https://bugs.webkit.org/attachment.cgi?id=228131&action=review

------- Additional Comments from Brent Fulgham <bfulgham at webkit.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=228131&action=review


A couple of minor questions, but looks good overall. R=me.

> Source/WTF/wtf/MathExtras.h:395
> +template<> inline double abs(const double& value) { return ::fabs(value); }

Doesn't the existing STL math library (<cmath>, or maybe <cfloat>) provide
template methods for these already?

> Source/WTF/wtf/NumericConversion.h:165
> +inline float narrowPrecisionTo(const float& value) { return value; }

Is there any advantage to range checks like you did for double->int here? IIRC,
floats have about an order of magnitude smaller range of values they can hold
(aside from the obvious precision differences).

> Source/WTF/wtf/NumericConversion.h:168
> +inline float narrowPrecisionTo(const double& value) { return
static_cast<float>(value); }

Obviously I meant the previous comment for this line!


More information about the webkit-reviews mailing list