lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 4f66e63 1/6: Resolve a clang complaint differ


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 4f66e63 1/6: Resolve a clang complaint differently
Date: Sun, 1 Oct 2017 14:20:02 -0400 (EDT)

branch: master
commit 4f66e63a504a185b20da6ee477a99153173a5431
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Resolve a clang complaint differently
    
    Revised the recent revision to prefer simplicity. See the thread that
    one can hope ends here:
      http://lists.nongnu.org/archive/html/lmi/2017-09/msg00015.html
---
 bourn_cast.hpp | 21 +--------------------
 1 file changed, 1 insertion(+), 20 deletions(-)

diff --git a/bourn_cast.hpp b/bourn_cast.hpp
index 92d05b1..dda5c46 100644
--- a/bourn_cast.hpp
+++ b/bourn_cast.hpp
@@ -115,25 +115,6 @@ inline To bourn_cast(From from, std::false_type, 
std::true_type)
     return static_cast<To>(from);
 }
 
-namespace lmi
-{
-/// A constexpr replacement for std::ldexp().
-///
-/// See:
-///   https://lists.nongnu.org/archive/html/lmi/2017-09/msg00003.html
-/// et seqq.
-
-template<typename T>
-constexpr T ldexp(T t, int exp)
-{
-    for(int i = 0; i < exp; ++i)
-        {
-        t *= T(2);
-        }
-    return t;
-}
-} // namespace lmi
-
 /// Floating to integral.
 ///
 /// Integral max() must be one less than an integer power of two,
@@ -193,7 +174,7 @@ inline To bourn_cast(From from, std::true_type, 
std::false_type)
     using from_traits = std::numeric_limits<From>;
     static_assert(to_traits::is_integer && !from_traits::is_integer, "");
 
-    constexpr From limit = lmi::ldexp(From(1), to_traits::digits);
+    From const limit = std::ldexp(From(1), to_traits::digits);
 
     constexpr bool is_twos_complement(~To(0) == -To(1));
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]