Subzero. ARM32. Improve constant lowering.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=4076
R=stichnot@chromium.org
Review URL: https://codereview.chromium.org/1438773004 .
diff --git a/src/IceUtils.h b/src/IceUtils.h
index 9387671..0080a11 100644
--- a/src/IceUtils.h
+++ b/src/IceUtils.h
@@ -16,6 +16,7 @@
#define SUBZERO_SRC_ICEUTILS_H
#include <climits>
+#include <cmath> // std::signbit()
namespace Ice {
@@ -117,6 +118,13 @@
return value;
return (value >> shift) | (value << (32 - shift));
}
+
+ /// Returns true if Val is +0.0. It requires T to be a floating point type.
+ template <typename T> static bool isPositiveZero(T Val) {
+ static_assert(std::is_floating_point<T>::value,
+ "Input type must be floating point");
+ return Val == 0 && !std::signbit(Val);
+ }
};
} // end of namespace Ice