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

The "official" (portable) way of writing a uint64_t constant uses UINT64_C().


diffs (49 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
@@ -462,10 +462,10 @@ popcount64(uint64_t x)
        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 (int) ((x * 0x0101010101010101ULL) >> 56);
+       x = (x & UINT64_C(0x5555555555555555)) + ((x >> 1) & 
UINT64_C(0x5555555555555555));
+       x = (x & UINT64_C(0x3333333333333333)) + ((x >> 2) & 
UINT64_C(0x3333333333333333));
+       x = (x & UINT64_C(0x0F0F0F0F0F0F0F0F)) + ((x >> 4) & 
UINT64_C(0x0F0F0F0F0F0F0F0F));
+       return (int) ((x * UINT64_C(0x0101010101010101)) >> 56);
 #endif
 }
 
@@ -501,10 +501,10 @@ str_alphabet_bitmap(str_item *s)
 {
        int i;
 
-       s->abm = 0ULL;
+       s->abm = UINT64_C(0);
 
        for (i = 0; i < s->len; i++)
-               s->abm |= 1ULL << (s->cp_sequence[i] % 64);
+               s->abm |= UINT64_C(1) << (s->cp_sequence[i] % 64);
 
        s->abm_popcount = popcount64(s->abm);
 }
diff --git a/sql/server/rel_optimize_sel.c b/sql/server/rel_optimize_sel.c
--- a/sql/server/rel_optimize_sel.c
+++ b/sql/server/rel_optimize_sel.c
@@ -2056,10 +2056,10 @@ popcount64(uint64_t x)
        return (uint32_t) __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;
+       x = (x & UINT64_C(0x5555555555555555)) + ((x >> 1) & 
UINT64_C(0x5555555555555555));
+       x = (x & UINT64_C(0x3333333333333333)) + ((x >> 2) & 
UINT64_C(0x3333333333333333));
+       x = (x & UINT64_C(0x0F0F0F0F0F0F0F0F)) + ((x >> 4) & 
UINT64_C(0x0F0F0F0F0F0F0F0F));
+       return (x * UINT64_C(0x0101010101010101)) >> 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