Changeset: e3d86f634f69 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e3d86f634f69
Modified Files:
        gdk/gdk.h
        gdk/gdk_batop.c
        gdk/gdk_col.c
Branch: headless
Log Message:

Get rid of loc, it's called COLelement now.


diffs (220 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1217,19 +1217,19 @@
                } else                                                  \
                        ATOMreplace((b)->type, (b)->vheap, (p), v);     \
        } while (0)
-#define fastins_nocheck(b, p, v, s)                    \
-       do {                                            \
-               assert((b)->width == (s));              \
-               (b)->heap.free += (s);                  \
-               putvalue((b), loc((b), (p)), (v), 0);   \
+#define fastins_nocheck(b, p, v, s)                            \
+       do {                                                    \
+               assert((b)->width == (s));                      \
+               (b)->heap.free += (s);                          \
+               putvalue((b), COLelement((b), (p)), (v), 0);    \
        } while (0)
-#define bunfastins_nocheck(b, p, v, vs)                        \
-       do {                                            \
-               assert((b)->width == (vs));             \
-               (b)->heap.free += (vs);                 \
-               putvalue((b), loc((b), (p)), (v), 0);   \
-               (b)->count++;                           \
-       } while (0)                                     \
+#define bunfastins_nocheck(b, p, v, vs)                                \
+       do {                                                    \
+               assert((b)->width == (vs));                     \
+               (b)->heap.free += (vs);                         \
+               putvalue((b), COLelement((b), (p)), (v), 0);    \
+               (b)->count++;                                   \
+       } while (0)
 
 #define bunfastins(b, v)                                               \
        do {                                                            \
@@ -1294,8 +1294,7 @@
 /* new semantics ! */
 #define headsize(b,p)  ((b)->type?((size_t)(p))<<(b)->shift:0)
 
-#define loc(b,p)       ((b)->heap.base+((p)<<(b)->shift))
-#define COLelement(b,p) loc(b,p)
+#define COLelement(b,p) ((b)->heap.base+((p)<<(b)->shift))
 
 #if SIZEOF_VAR_T < SIZEOF_VOID_P
 /* NEW 11/4/2009: when compiled with 32-bits oids/var_t on 64-bits
@@ -1344,7 +1343,7 @@
 #define VarHeapVal(b,p,w) ((size_t) VarHeapValRaw(b,p,w)  << GDK_VARSHIFT)
 #define BUNvaroff(bi,p) VarHeapVal((bi).b->heap.base, (p), (bi).b->width)
 
-#define BUNloc(bi,p)   loc((bi).b,p)
+#define BUNloc(bi,p)   COLelement((bi).b,p)
 #define BUNpos(bi,p)   ((bi).vid = (bi).b->seqbase + ((bi).b->seqbase == 
oid_nil ? 0 : (p) - (bi).b->first), (char *) &(bi).vid)
 #define BUNvar(bi,p)   
((bi).b->type?(base((bi).b)+BUNvaroff(bi,p)):BUNpos(bi,p))
 #define BUNhead(bi,p)  ((bi).b->varsized?BUNvar(bi,p):BUNloc(bi,p))
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -516,7 +516,7 @@
                HASHloop_typed(bi, b->hash, i, tl, TYPE) {              \
                        if (q < r) {                                    \
                                bunfastins_nocheck(bn, q, &i, size(bn)); \
-                               if (q > 0 && * (oid *) loc(nb,q-1) < i) \
+                               if (q > 0 && * (oid *) COLelement(nb,q-1) < i) \
                                        bn->sorted = 0;                 \
                        }                                               \
                        q++;                                            \
@@ -567,7 +567,7 @@
                                HASHloop_fstr(bi, b->hash, p, j, tl) {
                                        if (q < r) {
                                                bunfastins_nocheck(bn, q, &i, 
size(bn));
-                                               if (q > 0 && * (oid *) 
loc(nb,q-1) < i)
+                                               if (q > 0 && * (oid *) 
COLelement(nb,q-1) < i)
                                                        bn->sorted = 0; 
                                        }
                                        q++;
@@ -578,7 +578,7 @@
                                HASHloop_str(bi, b->hash, p, tl) {
                                        if (q < r) {
                                                bunfastins_nocheck(bn, q, &i, 
size(bn));
-                                               if (q > 0 && * (oid *) 
loc(nb,q-1) < i)
+                                               if (q > 0 && * (oid *) 
COLelement(nb,q-1) < i)
                                                        bn->sorted = 0; 
                                        }
                                        q++;
@@ -591,7 +591,7 @@
                                HASHloopvar(bi, b->hash, i, tl) {
                                        if (q < r) {
                                                bunfastins_nocheck(bn, q, &i, 
size(bn));
-                                               if (q > 0 && * (oid *) 
loc(nb,q-1) < i)
+                                               if (q > 0 && * (oid *) 
COLelement(nb,q-1) < i)
                                                        bn->sorted = 0; 
                                        }
                                        q++;
@@ -600,7 +600,7 @@
                                HASHlooploc(bi, b->hash, i, tl) {
                                        if (q < r) {
                                                bunfastins_nocheck(bn, q, &i, 
size(bn));
-                                               if (q > 0 && * (oid *) 
loc(nb,q-1) < i)
+                                               if (q > 0 && * (oid *) 
COLelement(nb,q-1) < i)
                                                        bn->sorted = 0; 
                                        }
                                        q++;
@@ -1200,16 +1200,16 @@
        }
        if (stable) {
                if (reverse) {
-                       if (GDKssort_rev(loc(b, BUNfirst(b)),
-                                        o ? loc(o, BUNfirst(o)) : NULL,
+                       if (GDKssort_rev(COLelement(b, BUNfirst(b)),
+                                        o ? COLelement(o, BUNfirst(o)) : NULL,
                                         b->vheap ? b->vheap->base : NULL,
                                         COLcount(b),
                                         size(b),
                                         b->type) < 0)
                                return NULL;
                } else {
-                       if (GDKssort(loc(b, BUNfirst(b)),
-                                    o ? loc(o, BUNfirst(o)) : NULL,
+                       if (GDKssort(COLelement(b, BUNfirst(b)),
+                                    o ? COLelement(o, BUNfirst(o)) : NULL,
                                     b->vheap ? b->vheap->base : NULL,
                                     COLcount(b),
                                     size(b),
@@ -1218,15 +1218,15 @@
                }
        } else {
                if (reverse)
-                       GDKqsort_rev(loc(b, BUNfirst(b)),
-                                    o ? loc(o, BUNfirst(o)) : NULL,
+                       GDKqsort_rev(COLelement(b, BUNfirst(b)),
+                                    o ? COLelement(o, BUNfirst(o)) : NULL,
                                     b->vheap ? b->vheap->base : NULL,
                                     COLcount(b),
                                     size(b),
                                     b->type);
                else
-                       GDKqsort(loc(b, BUNfirst(b)),
-                                o ? loc(o, BUNfirst(o)) : NULL,
+                       GDKqsort(COLelement(b, BUNfirst(b)),
+                                o ? COLelement(o, BUNfirst(o)) : NULL,
                                 b->vheap ? b->vheap->base : NULL,
                                 COLcount(b),
                                 size(b),
@@ -2012,28 +2012,28 @@
        } else {
                switch (ATOMsize(ATOMstorage(tpe))) {
                case 1:{
-                       bte *d = (bte *) loc(bn, BUNfirst(bn)), V = *(bte *) v;
+                       bte *d = (bte *) COLelement(bn, BUNfirst(bn)), V = 
*(bte *) v;
                        for (r = 0; r < cnt; r++)
                                d[r] = V;
                        COLsetcount(bn, cnt);
                        break;
                }
                case 2:{
-                       sht *d = (sht *) loc(bn, BUNfirst(bn)), V = *(sht *) v;
+                       sht *d = (sht *) COLelement(bn, BUNfirst(bn)), V = 
*(sht *) v;
                        for (r = 0; r < cnt; r++)
                                d[r] = V;
                        COLsetcount(bn, cnt);
                        break;
                }
                case 4:{
-                       int *d = (int *) loc(bn, BUNfirst(bn)), V = *(int *) v;
+                       int *d = (int *) COLelement(bn, BUNfirst(bn)), V = 
*(int *) v;
                        for (r = 0; r < cnt; r++)
                                d[r] = V;
                        COLsetcount(bn, cnt);
                        break;
                }
                case 8:{
-                       lng *d = (lng *) loc(bn, BUNfirst(bn)), V = *(lng *) v;
+                       lng *d = (lng *) COLelement(bn, BUNfirst(bn)), V = 
*(lng *) v;
                        for (r = 0; r < cnt; r++)
                                d[r] = V;
                        COLsetcount(bn, cnt);
diff --git a/gdk/gdk_col.c b/gdk/gdk_col.c
--- a/gdk/gdk_col.c
+++ b/gdk/gdk_col.c
@@ -783,8 +783,8 @@
                        /* case (4): optimized for simple array copy */
                        int tpe = ATOMstorage(ht);
                        oid p = BUNfirst(b);
-                       char *cur = loc(b, p);
-                       char *d = loc(bn, 0);
+                       char *cur = COLelement(b, p);
+                       char *d = COLelement(bn, 0);
 
                        bn->heap.free = bunstocopy * size(bn);
 
@@ -1110,11 +1110,11 @@
                        }
 
                        /* move first to tmp */
-                       un_move(loc(b, l), htmp, hs);
+                       un_move(COLelement(b, l), htmp, hs);
                        /* move delete to first */
-                       un_move(loc(b, p), loc(b, l), hs);
+                       un_move(COLelement(b, p), COLelement(b, l), hs);
                        /* move first to deleted */
-                       un_move(htmp, loc(b, p), hs);
+                       un_move(htmp, COLelement(b, p), hs);
 
                        if (b->sorted & 1) {
                                b->sorted = FALSE;
@@ -1158,11 +1158,11 @@
                        }
 
                        /* move first to tmp */
-                       un_move(loc(b, last), htmp, hs);
+                       un_move(COLelement(b, last), htmp, hs);
                        /* move delete to first */
-                       un_move(loc(b, p), loc(b, last), hs);
+                       un_move(COLelement(b, p), COLelement(b, last), hs);
                        /* move first to deleted */
-                       un_move(htmp, loc(b, p), hs);
+                       un_move(htmp, COLelement(b, p), hs);
 
                        /* If a column was sorted before the oid was
                           deleted, check whether it is still sorted
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to