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

XIDencode(): correctly do XIDBASE encoding according to its intention

well, at least to the extend I understand its intention;
at least, now encoding plus decoding it does produce correct results


diffs (50 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
@@ -93,7 +93,6 @@ XIDencode(BUN *rtrn, XIDcolumn col, oid 
                        case XIDRANGEINC:
                        case XIDRANGEDEC:
                        case XIDPOINT:
-                               i++;
                                break;
                        case XIDSETINC:
                        case XIDSETDEC:
@@ -102,15 +101,19 @@ XIDencode(BUN *rtrn, XIDcolumn col, oid 
                                        col[i].x.val = prev;
                                        scnt =0;
                                }
-                               /* finish the current*/
-                               i++;
                                break;
                        default:
                                throw(MAL, "xid.compress", "unknown col.x.tag 
in XIDencode() [1]");
                        }
-                       col[i].x.tag = XIDBASE;
-                       min = col[i + 1].count = o;
-                       i += 2;
+                       i++;
+                       col[i++].x.tag = XIDBASE;
+                       col[i++].count = min = o;
+                       o -= min;
+                       assert(o <= XID_VAL_MAX);
+                       v = (xid) o;
+                       col[i].x.val = v;
+                       col[i].x.tag = XIDPOINT;
+                       continue;
                }
                o -= min;
                assert(o <= XID_VAL_MAX);
@@ -258,13 +261,6 @@ XIDencode(BUN *rtrn, XIDcolumn col, oid 
                                //mnstr_printf(GDKout,"xidpoint " BUNFMT " " 
XIDFMT "\n",i,v);
                        }
                        break;
-               case XIDBASE :
-                       /* skip it and start a new point encoding */
-                       i += 2;
-                       col[i].x.tag = XIDPOINT;
-                       col[i].x.val = v;
-                       //mnstr_printf(GDKout,"xidpoint " BUNFMT " " XIDFMT 
"\n",i,v);
-                       break;
                default:
                        throw(MAL, "xid.compress", "unknown col.x.tag in 
XIDencode() [2]");
                }
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to