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

Unified Diff: base/numerics/safe_math_impl.h

Issue 1995753003: Cleanup some constexpr nits in base/numerics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 7 months 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
« no previous file with comments | « base/numerics/safe_conversions_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/numerics/safe_math_impl.h
diff --git a/base/numerics/safe_math_impl.h b/base/numerics/safe_math_impl.h
index eeda234796ec179f034121e9385259e7cd4c6b4a..77a9b0ba3c8b0395da0a630efc137a640fc73856 100644
--- a/base/numerics/safe_math_impl.h
+++ b/base/numerics/safe_math_impl.h
@@ -115,7 +115,7 @@ struct UnsignedOrFloatForSize<Numeric, false, true> {
// Helper templates for integer manipulations.
template <typename T>
-bool HasSignBit(T x) {
+constexpr bool HasSignBit(T x) {
// Cast to unsigned since right shift on signed is undefined.
return !!(static_cast<typename UnsignedIntegerForSize<T>::type>(x) >>
PositionOfSignBit<T>::value);
@@ -123,7 +123,7 @@ bool HasSignBit(T x) {
// This wrapper undoes the standard integer promotions.
template <typename T>
-T BinaryComplement(T x) {
+constexpr T BinaryComplement(T x) {
return static_cast<T>(~x);
}
« no previous file with comments | « base/numerics/safe_conversions_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698