Changeset: 9ae07cb8cf69 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9ae07cb8cf69
Modified Files:
        monetdb5/modules/mal/txtsim.c
Branch: default
Log Message:

No __popcnt64() on 32 bit Windows.


diffs (26 lines):

diff --git a/monetdb5/modules/mal/txtsim.c b/monetdb5/modules/mal/txtsim.c
--- a/monetdb5/modules/mal/txtsim.c
+++ b/monetdb5/modules/mal/txtsim.c
@@ -451,14 +451,19 @@ static inline int
 popcount64(uint64_t x)
 {
 #if defined(__GNUC__)
-       return (uint32_t) __builtin_popcountll(x);
+       return (int) __builtin_popcountll(x);
 #elif defined(_MSC_VER)
-       return (uint32_t) __popcnt64(x);
+#if SIZEOF_OID == 4
+       /* no __popcnt64 on 32 bit Windows */
+       return (int) (__popcnt((uint32_t) x) + __popcnt((uint32_t) (x >> 32)));
+#else
+       return (int) __popcnt64(x);
+#endif
 #else
        x = (x & 0x5555555555555555ULL) + ((x >> 1) & 0x5555555555555555ULL);
        x = (x & 0x3333333333333333ULL) + ((x >> 2) & 0x3333333333333333ULL);
        x = (x & 0x0F0F0F0F0F0F0F0FULL) + ((x >> 4) & 0x0F0F0F0F0F0F0F0FULL);
-       return (x * 0x0101010101010101ULL) >> 56;
+       return (int) ((x * 0x0101010101010101ULL) >> 56);
 #endif
 }
 
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to