Changeset: d9262db80474 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d9262db80474
Modified Files:
        monetdb5/modules/atoms/bigram.h
        monetdb5/modules/atoms/str.c
Branch: default
Log Message:

Use unsigned in ng sigs/idx to avoid undefined before in Windows OS


diffs (68 lines):

diff --git a/monetdb5/modules/atoms/bigram.h b/monetdb5/modules/atoms/bigram.h
--- a/monetdb5/modules/atoms/bigram.h
+++ b/monetdb5/modules/atoms/bigram.h
@@ -14,13 +14,13 @@
 #include "gdk.h"
 
 #ifdef HAVE_HGE
-#define NG_TYPE                hge
+#define NG_TYPE                uhge
 #define NG_TYPEID      TYPE_hge
 #define NG_TYPENIL     hge_nil
 #define NG_BITS                128
 #define NG_MASK(s)     (s & (NG_BITS - 1))
 #else
-#define NG_TYPE                lng
+#define NG_TYPE                ulng
 #define NG_TYPEID      TYPE_lng
 #define NG_TYPENIL     lng_nil
 #define NG_BITS                64
@@ -41,6 +41,6 @@ typedef struct {
        NG_TYPE *sigs;
        unsigned *histogram;
        unsigned min, max;
-       oid *lists;
+       unsigned *lists;
        oid *rids;
 } NGrams;
diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c
--- a/monetdb5/modules/atoms/str.c
+++ b/monetdb5/modules/atoms/str.c
@@ -2173,9 +2173,9 @@ init_bigram_idx(NGrams *ng, BATiter *bi,
        unsigned (*h_tmp)[NG_BITS] = GDKzalloc(BIGRAM_SZ * sizeof(unsigned));
        unsigned *h_tmp_ptr = (unsigned *) h_tmp;
        unsigned *map = GDKmalloc(BIGRAM_SZ * sizeof(unsigned));
-       oid *lists = ng->lists;
+       unsigned *lists = ng->lists;
        oid *rids = ng->rids;
-       oid k = 1;
+       unsigned k = 1;
 
        if (!h_tmp || !map) {
                GDKfree(h_tmp);
@@ -2195,7 +2195,7 @@ init_bigram_idx(NGrams *ng, BATiter *bi,
                                h_tmp[ENC_TOKEN1(s)][ENC_TOKEN2(s)]++;
        }
 
-       for (size_t i = 0; i < BIGRAM_SZ; i++) {
+       for (unsigned i = 0; i < BIGRAM_SZ; i++) {
                map[i] = i;
                idx[i] = lists[i] = 0;
                h[i] = h_tmp_ptr[i];
@@ -2232,6 +2232,7 @@ init_bigram_idx(NGrams *ng, BATiter *bi,
                                        if (lists[enc_bigram] == 0) {
                                                lists[enc_bigram] = k;
                                                k += h[enc_bigram];
+                                               assert(k <= UINT32_MAX);
                                                h[enc_bigram] = 0;
                                        }
                                        int done = (h[enc_bigram] > 0 &&
@@ -2269,7 +2270,7 @@ bigram_strjoin(BAT *rl, BAT *rr, BATiter
        NG_TYPE *idx = ng->idx;
        NG_TYPE *sigs = ng->sigs;
        unsigned *h = ng->histogram;
-       oid *lists = ng->lists;
+       unsigned *lists = ng->lists;
        oid *rids = ng->rids;
        size_t new_cap;
 
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to