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

Unified Diff: base/numerics/safe_conversions.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 | « no previous file | base/numerics/safe_conversions_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/numerics/safe_conversions.h
diff --git a/base/numerics/safe_conversions.h b/base/numerics/safe_conversions.h
index 0dd71263b2ba647a87e26226dc6843506336e2a5..6b558afde405067e9378f077b6951ef80ee4c8cc 100644
--- a/base/numerics/safe_conversions.h
+++ b/base/numerics/safe_conversions.h
@@ -18,7 +18,7 @@ namespace base {
// Convenience function that returns true if the supplied value is in range
// for the destination type.
template <typename Dst, typename Src>
-inline constexpr bool IsValueInRangeForNumericType(Src value) {
+constexpr bool IsValueInRangeForNumericType(Src value) {
return internal::DstRangeRelationToSrcRange<Dst>(value) ==
internal::RANGE_VALID;
}
@@ -71,8 +71,8 @@ namespace internal {
// This wrapper is used for C++11 constexpr support by avoiding the declaration
// of local variables in the saturated_cast template function.
template <typename Dst, class NaNHandler, typename Src>
-inline constexpr Dst saturated_cast_impl(const Src value,
- const RangeConstraint constraint) {
+constexpr Dst saturated_cast_impl(const Src value,
+ const RangeConstraint constraint) {
return constraint == RANGE_VALID
? static_cast<Dst>(value)
: (constraint == RANGE_UNDERFLOW
@@ -92,7 +92,7 @@ inline constexpr Dst saturated_cast_impl(const Src value,
template <typename Dst,
class NaNHandler = SaturatedCastNaNBehaviorReturnZero,
typename Src>
-inline constexpr Dst saturated_cast(Src value) {
+constexpr Dst saturated_cast(Src value) {
return std::numeric_limits<Dst>::is_iec559
? static_cast<Dst>(value) // Floating point optimization.
: internal::saturated_cast_impl<Dst, NaNHandler>(
@@ -103,7 +103,7 @@ inline constexpr Dst saturated_cast(Src value) {
// it will cause a compile failure if the destination type is not large enough
// to contain any value in the source type. It performs no runtime checking.
template <typename Dst, typename Src>
-inline constexpr Dst strict_cast(Src value) {
+constexpr Dst strict_cast(Src value) {
static_assert(std::numeric_limits<Src>::is_specialized,
"Argument must be numeric.");
static_assert(std::numeric_limits<Dst>::is_specialized,
« no previous file with comments | « no previous file | base/numerics/safe_conversions_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698