Changeset: e36b651f4a83 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e36b651f4a83
Modified Files:
        monetdb5/modules/kernel/bat5.c
Branch: Oct2014
Log Message:

Fix changeset 6c4080d30b3e: only decrement ol if we "use" the value.
The unfixed version caused monetdb5/mal/tst866 to fail.


diffs (57 lines):

diff --git a/monetdb5/modules/kernel/bat5.c b/monetdb5/modules/kernel/bat5.c
--- a/monetdb5/modules/kernel/bat5.c
+++ b/monetdb5/modules/kernel/bat5.c
@@ -2198,9 +2198,10 @@ BKCshrinkBATmap(int *ret, int *bid, int 
                Type *r = (Type*)Tloc(bn, BUNfirst(bn));        \
                for (;p<q; oidx++, p++) {                                       
\
                        if ( *o == oidx ){                                      
        \
-                               while ( ol>o && *--ol == bidx) {                
\
+                               while ( ol>o && ol[-1] == bidx) {       \
                                        bidx--;                                 
                \
-                                       q--;                                    
        \
+                                       q--;                                    
                \
+                                       ol--;                                   
                \
                                }                                               
                        \
                                *r++ = *(--q);                                  
        \
                                o += (o < ol);                                  
        \
@@ -2242,7 +2243,7 @@ BKCreuseBAT(int *ret, int *bid, int *did
        }
 
        oidx = b->hseqbase;
-       bidx = oidx + BUNlast(b)-1;
+       bidx = oidx + BATcount(b)-1;
        o = (oid*)Tloc(bs, BUNfirst(bs));
        ol= (oid*)Tloc(bs, BUNlast(bs));
 
@@ -2263,9 +2264,10 @@ BKCreuseBAT(int *ret, int *bid, int *did
 
                        for (;p<q; oidx++, p++) {
                                if ( *o == oidx ){
-                                       while ( ol > o && *--ol == bidx) {
+                                       while ( ol > o && ol[-1] == bidx) {
                                                bidx--;
                                                q--;
+                                               ol--;
                                        }
                                        BUNappend(bn, BUNtail(bi, --q), FALSE);
                                        o += (o < ol);
@@ -2335,14 +2337,15 @@ BKCreuseBATmap(int *ret, int *bid, int *
 
        oidx = b->hseqbase;
        bidx = oidx + BUNlast(b)-1;
-       o  = (oid*)Tloc(bs, BUNfirst(bs));
-       ol = (oid*)Tloc(bs, BUNlast(bs));
-       r  = (oid*)Tloc(bn, BUNfirst(bn));
+       o  = (oid*)Tloc(bs, BUNfirst(bs));
+       ol = (oid*)Tloc(bs, BUNlast(bs));
+       r  = (oid*)Tloc(bn, BUNfirst(bn));
 
        for (;oidx<bidx; oidx++) {
                if ( *o == oidx ){
-                       while ( ol > o && *--ol == bidx) {
+                       while ( ol > o && ol[-1] == bidx) {
                                bidx--;
+                               ol--;
                        }
                        *r++ = bidx;
                        o += (o < ol);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to