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

used builtin's for popcount


diffs (20 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
@@ -450,10 +450,16 @@ typedef struct {
 static inline int
 popcount64(uint64_t x)
 {
+#if defined(__GNUC__)
+       return (uint32_t) __builtin_popcountll(x);
+#elif defined(_MSC_VER)
+       return (uint32_t) __popcnt64(x);
+#else
        x = (x & 0x5555555555555555ULL) + ((x >> 1) & 0x5555555555555555ULL);
        x = (x & 0x3333333333333333ULL) + ((x >> 2) & 0x3333333333333333ULL);
        x = (x & 0x0F0F0F0F0F0F0F0FULL) + ((x >> 4) & 0x0F0F0F0F0F0F0F0FULL);
        return (x * 0x0101010101010101ULL) >> 56;
+#endif
 }
 
 static int
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to