diff options
author | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2017-01-27 18:09:22 +0000 |
---|---|---|
committer | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2017-01-27 18:09:22 +0000 |
commit | 12313d44cf18e9431eedd5d0ed5ca58edce652e1 (patch) | |
tree | 1655ef074ac164969c53ea8a9254a8cd77ae1b2d /openmp/runtime/src/kmp_sched.cpp | |
parent | 3061e3e454bc80b4a8062b605b95c1a954fe7130 (diff) | |
download | bcm5719-llvm-12313d44cf18e9431eedd5d0ed5ca58edce652e1.tar.gz bcm5719-llvm-12313d44cf18e9431eedd5d0ed5ca58edce652e1.zip |
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
Diffstat (limited to 'openmp/runtime/src/kmp_sched.cpp')
-rw-r--r-- | openmp/runtime/src/kmp_sched.cpp | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/openmp/runtime/src/kmp_sched.cpp b/openmp/runtime/src/kmp_sched.cpp index ee6bb67df1a..c19fe442772 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 @@ __kmp_for_static_init( *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 @@ __kmp_dist_for_static_init( // 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 @@ __kmp_dist_for_static_init( } } 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 @@ __kmp_dist_for_static_init( *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 @@ __kmp_dist_for_static_init( *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 @@ __kmp_team_static_init( // 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 } |