Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: src/IceUtils.h

Issue 1438773004: Subzero. ARM32. Improve constant lowering. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: git pull Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/IceUtils.h
diff --git a/src/IceUtils.h b/src/IceUtils.h
index 9387671fa21b5a54e6cf9d5b654dbd1b6b0fd89a..cfe9a353ae4ed3b81b473f621159acf7104b3a11 100644
--- a/src/IceUtils.h
+++ b/src/IceUtils.h
@@ -16,6 +16,7 @@
#define SUBZERO_SRC_ICEUTILS_H
#include <climits>
+#include <cmath> // signbit()
namespace Ice {
@@ -117,6 +118,13 @@ public:
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 && !signbit(Val);
Jim Stichnoth 2015/11/17 04:00:36 std::signbit
John 2015/11/17 22:17:05 Done.
+ }
};
} // end of namespace Ice

Powered by Google App Engine
This is Rietveld 408576698