[PPL-devel] [GIT] ppl/ppl(master): Simplified min/max evaluation.

Abramo Bagnara abramo.bagnara at gmail.com
Thu Feb 23 13:34:15 CET 2012


Module: ppl/ppl
Branch: master
Commit: 4181f769db322af862f7eab29dd7c742a1f48f51
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=4181f769db322af862f7eab29dd7c742a1f48f51

Author: Abramo Bagnara <abramo.bagnara at gmail.com>
Date:   Thu Feb 23 13:34:11 2012 +0100

Simplified min/max evaluation.

---

 src/C_Integer.hh |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/C_Integer.hh b/src/C_Integer.hh
index 83ddfe6..4777e0a 100644
--- a/src/C_Integer.hh
+++ b/src/C_Integer.hh
@@ -144,8 +144,8 @@ struct C_Integer<unsigned char> : public True {
   typedef void smaller_signed_type;
   typedef void smaller_unsigned_type;
   typedef signed char other_type;
-  static const unsigned char min = 0;
-  static const unsigned char max = UCHAR_MAX;
+  static const unsigned char min = 0U;
+  static const unsigned char max = static_cast<unsigned char>(~0U);
 };
 
 template <>
@@ -155,8 +155,8 @@ struct C_Integer<unsigned short> : public True {
   typedef signed char smaller_signed_type;
   typedef unsigned char smaller_unsigned_type;
   typedef signed short other_type;
-  static const unsigned short min = 0;
-  static const unsigned short max = USHRT_MAX;
+  static const unsigned short min = 0U;
+  static const unsigned short max = static_cast<unsigned short>(~0U);
 };
 
 template <>
@@ -166,8 +166,8 @@ struct C_Integer<unsigned int> : public True {
   typedef signed short smaller_signed_type;
   typedef unsigned short smaller_unsigned_type;
   typedef signed int other_type;
-  static const unsigned int min = 0;
-  static const unsigned int max = UINT_MAX;
+  static const unsigned int min = 0U;
+  static const unsigned int max = ~0U;
 };
 
 template <>
@@ -177,8 +177,8 @@ struct C_Integer<unsigned long> : public True {
   typedef signed int smaller_signed_type;
   typedef unsigned int smaller_unsigned_type;
   typedef signed long other_type;
-  static const unsigned long min = 0;
-  static const unsigned long max = ULONG_MAX;
+  static const unsigned long min = 0UL;
+  static const unsigned long max = ~0UL;
 };
 
 template <>
@@ -188,8 +188,8 @@ struct C_Integer<unsigned long long> : public True {
   typedef signed long smaller_signed_type;
   typedef unsigned long smaller_unsigned_type;
   typedef signed long long other_type;
-  static const unsigned long long min = 0;
-  static const unsigned long long max = ULLONG_MAX;
+  static const unsigned long long min = 0ULL;
+  static const unsigned long long max = ~0ULL;
 };
 
 } // namespace Parma_Polyhedra_Library




More information about the PPL-devel mailing list