Bug 1304310 - Remove else after return statement in ConvertScalar. r=arai
authorarn197 <aaronjacob00@gmail.com>
Wed, 21 Sep 2016 02:48:00 -0400
changeset 314859 9456e0185872a6262940f549aa50e67072de26cc
parent 314858 b695086b9861450bff219561e655a51ebd7dd5dd
child 314860 6a52aa73d6ea6c19b379894f17928fe80e05f63b
push id30735
push usercbook@mozilla.com
push dateThu, 22 Sep 2016 09:55:35 +0000
treeherdermozilla-central@f0e6cc636021 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarai
bugs1304310
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1304310 - Remove else after return statement in ConvertScalar. r=arai
js/src/builtin/TypedObject.h
--- a/js/src/builtin/TypedObject.h
+++ b/js/src/builtin/TypedObject.h
@@ -98,25 +98,24 @@ namespace js {
  * Helper method for converting a double into other scalar
  * types in the same way that JavaScript would. In particular,
  * simple C casting from double to int32_t gets things wrong
  * for values like 0xF0000000.
  */
 template <typename T>
 static T ConvertScalar(double d)
 {
-    if (TypeIsFloatingPoint<T>()) {
+    if (TypeIsFloatingPoint<T>())
         return T(d);
-    } else if (TypeIsUnsigned<T>()) {
+    if (TypeIsUnsigned<T>()) {
         uint32_t n = JS::ToUint32(d);
         return T(n);
-    } else {
-        int32_t n = JS::ToInt32(d);
-        return T(n);
     }
+    int32_t n = JS::ToInt32(d);
+    return T(n);
 }
 
 namespace type {
 
 enum Kind {
     Scalar = JS_TYPEREPR_SCALAR_KIND,
     Reference = JS_TYPEREPR_REFERENCE_KIND,
     Simd = JS_TYPEREPR_SIMD_KIND,