[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master ddca1f5 4/5: Refactor for reuse
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master ddca1f5 4/5: Refactor for reuse |
Date: |
Mon, 17 Apr 2017 13:33:49 -0400 (EDT) |
branch: master
commit ddca1f551cad87e7b5848a9d46cea6306a727c38
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Refactor for reuse
A constexpr distinguishing two's complement will be needed for
handling other integer representations.
---
bourn_cast.hpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bourn_cast.hpp b/bourn_cast.hpp
index b4812cf..eed2530 100644
--- a/bourn_cast.hpp
+++ b/bourn_cast.hpp
@@ -157,8 +157,8 @@ inline To bourn_cast(From from, std::true_type,
std::false_type)
static_assert(to_traits::is_integer && !from_traits::is_integer, "");
static_assert(to_traits::digits < from_traits::max_exponent, "");
- // Integral type must be two's complement.
- static_assert(~To(0) == -To(1), "");
+ static constexpr bool is_twos_complement(~To(0) == -To(1));
+ static_assert(is_twos_complement, "");
static From const volatile raw_max = From(to_traits::max());
static From const volatile adj_max = raw_max + From(1);