Cleanup: put i_maxmin members and ___kmp_size_type into traits_t

Put the duplicated i_maxmin into traits_t by adding new members max_value and
min_value. Put ___kmp_size_type into traits_t by adding member type_size.

Differential Revision: https://reviews.llvm.org/D28847

llvm-svn: 293316
diff --git a/openmp/runtime/src/kmp_sched.cpp b/openmp/runtime/src/kmp_sched.cpp
index ee6bb67..c19fe44 100644
--- a/openmp/runtime/src/kmp_sched.cpp
+++ b/openmp/runtime/src/kmp_sched.cpp
@@ -33,33 +33,6 @@
 #include "ompt-specific.h"
 #endif
 
-// template for type limits
-template< typename T >
-struct i_maxmin {
-    static const T mx;
-    static const T mn;
-};
-template<>
-struct i_maxmin< int > {
-    static const int mx = 0x7fffffff;
-    static const int mn = 0x80000000;
-};
-template<>
-struct i_maxmin< unsigned int > {
-    static const unsigned int mx = 0xffffffff;
-    static const unsigned int mn = 0x00000000;
-};
-template<>
-struct i_maxmin< long long > {
-    static const long long mx = 0x7fffffffffffffffLL;
-    static const long long mn = 0x8000000000000000LL;
-};
-template<>
-struct i_maxmin< unsigned long long > {
-    static const unsigned long long mx = 0xffffffffffffffffLL;
-    static const unsigned long long mn = 0x0000000000000000LL;
-};
-//-------------------------------------------------------------------------
 #ifdef KMP_DEBUG
 //-------------------------------------------------------------------------
 // template for debug prints specification ( d, u, lld, llu )
@@ -295,13 +268,13 @@
                     *pupper = *plower + big_chunk_inc_count - incr;
                     if ( incr > 0 ) {
                         if( *pupper < *plower )
-                            *pupper = i_maxmin< T >::mx;
+                            *pupper = traits_t<T>::max_value;
                         if( plastiter != NULL )
                             *plastiter = *plower <= old_upper && *pupper > old_upper - incr;
                         if ( *pupper > old_upper ) *pupper = old_upper; // tracker C73258
                     } else {
                         if( *pupper > *plower )
-                            *pupper = i_maxmin< T >::mn;
+                            *pupper = traits_t<T>::min_value;
                         if( plastiter != NULL )
                             *plastiter = *plower >= old_upper && *pupper < old_upper - incr;
                         if ( *pupper < old_upper ) *pupper = old_upper; // tracker C73258
@@ -511,7 +484,7 @@
             // Check/correct bounds if needed
             if( incr > 0 ) {
                 if( *pupperDist < *plower )
-                    *pupperDist = i_maxmin< T >::mx;
+                    *pupperDist = traits_t<T>::max_value;
                 if( plastiter != NULL )
                     *plastiter = *plower <= upper && *pupperDist > upper - incr;
                 if( *pupperDist > upper )
@@ -522,7 +495,7 @@
                 }
             } else {
                 if( *pupperDist > *plower )
-                    *pupperDist = i_maxmin< T >::mn;
+                    *pupperDist = traits_t<T>::min_value;
                 if( plastiter != NULL )
                     *plastiter = *plower >= upper && *pupperDist < upper - incr;
                 if( *pupperDist < upper )
@@ -580,7 +553,7 @@
                     *pupper = *plower + chunk_inc_count - incr;
                     if( incr > 0 ) {
                         if( *pupper < *plower )
-                            *pupper = i_maxmin< T >::mx;
+                            *pupper = traits_t<T>::max_value;
                         if( plastiter != NULL )
                             if( *plastiter != 0 && !(*plower <= upper && *pupper > upper - incr) )
                                 *plastiter = 0;
@@ -588,7 +561,7 @@
                             *pupper = upper;//tracker C73258
                     } else {
                         if( *pupper > *plower )
-                            *pupper = i_maxmin< T >::mn;
+                            *pupper = traits_t<T>::min_value;
                         if( plastiter != NULL )
                             if( *plastiter != 0 && !(*plower >= upper && *pupper < upper - incr) )
                                 *plastiter = 0;
@@ -729,12 +702,12 @@
     // Correct upper bound if needed
     if( incr > 0 ) {
         if( *p_ub < *p_lb ) // overflow?
-            *p_ub = i_maxmin< T >::mx;
+            *p_ub = traits_t<T>::max_value;
         if( *p_ub > upper )
             *p_ub = upper; // tracker C73258
     } else {   // incr < 0
         if( *p_ub > *p_lb )
-            *p_ub = i_maxmin< T >::mn;
+            *p_ub = traits_t<T>::min_value;
         if( *p_ub < upper )
             *p_ub = upper; // tracker C73258
     }