diff options
Diffstat (limited to 'timsort.h')
| -rw-r--r-- | timsort.h | 14 | 
1 files changed, 11 insertions, 3 deletions
| @@ -30,6 +30,14 @@ typedef unsigned __int64 uint64_t;  #endif  #endif +#ifndef MK_UINT64 +#if defined(WIN32) && defined(_MSC_VER) && _MSC_VER < 1300 +#define MK_UINT64(x) ((uint64_t)(x)) +#else +#define MK_UINT64(x) x##ULL +#endif +#endif +  #ifndef MAX  #define MAX(x,y) (((x) > (y) ? (x) : (y)))  #endif @@ -40,7 +48,7 @@ typedef unsigned __int64 uint64_t;  int compute_minrun(uint64_t);  #ifndef CLZ -#ifdef __GNUC__ +#if defined(__GNUC__) && ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ > 3))  #define CLZ __builtin_clzll  #else @@ -67,12 +75,12 @@ int clzll(uint64_t x) /* {{{ */  #endif  #endif -int compute_minrun(const uint64_t size) /* {{{ */ +int compute_minrun(uint64_t size) /* {{{ */  {    const int top_bit = 64 - CLZ(size);    const int shift = MAX(top_bit, 6) - 6;    const int minrun = size >> shift; -  const uint64_t mask = (1ULL << shift) - 1; +  const uint64_t mask = (MK_UINT64(1) << shift) - 1;    if (mask & size) return minrun + 1;    return minrun;  } | 
