Changeset: 10804e2719bb for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=10804e2719bb
Modified Files:
        monetdb5/modules/mal/xid.c
Branch: xid
Log Message:

xid.c: no need to spend extra tag-bit on XIDBASE


diffs (75 lines):

diff --git a/monetdb5/modules/mal/xid.c b/monetdb5/modules/mal/xid.c
--- a/monetdb5/modules/mal/xid.c
+++ b/monetdb5/modules/mal/xid.c
@@ -26,13 +26,12 @@
 #include "mal_interpreter.h"
 #include "xid.h"
 
-#define XIDBASE     0
+#define XIDPOINT    0
 #define XIDSETINC   1
 #define XIDSETDEC   2
 #define XIDRANGEINC 3
 #define XIDRANGEDEC 4
 #define XIDRANGEEQ  5
-#define XIDPOINT    6
 /* must be < 2^XID_TAG_BITS i.e. < 1<<XID_TAG_BITS */
 
 typedef oid xid;
@@ -51,21 +50,23 @@ XIDencode(BUN *rtrn, XIDcolumn col, oid 
 {
        oid o;
        xid v, prev=0;
-       BUN i=0,scnt =0; 
+       BUN i=1,scnt =0; 
        //xid point=0, range=0,set=0;
 
-       col[++i].tag = XIDBASE;
+       o = *(oid*) p++;
+       if (o > XID_VAL_MAX)
+               throw(MAL, "xid.compress", "value too large in XIDencode()");
+       v = (xid) o;
+       col[i].value = v;
+       col[i].tag = XIDPOINT;
+       //mnstr_printf(GDKout,"xidpoint " BUNFMT " " XIDFMT "\n",i,v);
+       
        for ( ; p<q ; p++) {
                o = *(oid*) p;
                if (o > XID_VAL_MAX)
                        throw(MAL, "xid.compress", "value too large in 
XIDencode()");
                v = (xid) o;
                switch ( col[i].tag ) {
-               case XIDBASE:
-                       col[i].tag = XIDPOINT;
-                       col[i].value = v;
-                       //mnstr_printf(GDKout,"xidpoint " BUNFMT " " XIDFMT 
"\n",i,v);
-                       break;
                case XIDSETINC:
                        /* works only for strictly increasing sets (sequences);
                         * otherwise, we loose order information
@@ -255,7 +256,6 @@ XIDcompress(Client cntxt, MalBlkPtr mb, 
                        BBPreleaseref(bn->batCacheid);
                        return msg;
                }
-               col[0].tag  = XIDBASE;
                if (i+1 > XID_VAL_MAX) {
                        BBPreleaseref(b->batCacheid);
                        BBPreleaseref(bn->batCacheid);
@@ -289,7 +289,6 @@ XIDcompress(Client cntxt, MalBlkPtr mb, 
                        BBPreleaseref(bn->batCacheid);
                        return msg;
                }
-               col[0].tag  = XIDBASE;
                if (i+1 > XID_VAL_MAX) {
                        BBPreleaseref(b->batCacheid);
                        BBPreleaseref(bn->batCacheid);
@@ -479,9 +478,6 @@ XIDcolumndump(stream *f, XIDcolumn col, 
        for ( i=1 ; i<lim; i++) {
                v = col[i].value;
                switch ( col[i].tag ) {
-               case XIDBASE:
-                       mnstr_printf(f,"x:" XIDFMT "", v);
-                       break;
                case XIDSETINC:
                        mnstr_printf(f,"s+:[" XIDFMT "] 0%llo",(xid) 
col[i-1].value,(lng)v);
                        break;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to