diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2014-09-02 13:34:01 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2014-09-02 13:34:01 +0400 |
commit | fa06cf6edf86aa1839d4f43bfd3bd9a3a36b5223 (patch) | |
tree | 705466443ec58fffa74a3499a3bcc56be1cdee9d /timsort.h | |
parent | 08f466c86ef859f2f3ab1f65677536cbccd85960 (diff) | |
parent | 3a8c2d58eab0410fe5e79a112614aa9be061dc46 (diff) | |
download | libxml2-fa06cf6edf86aa1839d4f43bfd3bd9a3a36b5223.tar.gz |
Merge branch 'master' of git://anonscm.debian.org/debian-xml-sgml/libxml2
Conflicts:
debian/changelog
debian/control
debian/rules
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; } |