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

Unified Diff: base/numerics/safe_math_impl.h

Issue 2559183004: Revert of Remove bad comment in HasSignBit (Closed)
Patch Set: Created 4 years 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 | « no previous file | 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 b3f7f82445d2822aa88d434729f85d2962b2b263..f648d1642074f9071c66891e9bd2f4e8f7a7afb8 100644
--- a/base/numerics/safe_math_impl.h
+++ b/base/numerics/safe_math_impl.h
@@ -46,6 +46,7 @@
template <typename T>
constexpr bool HasSignBit(T x) {
+ // Cast to unsigned since right shift on signed is undefined.
return static_cast<typename std::make_signed<T>::type>(x) <
static_cast<typename std::make_signed<T>::type>(0);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698