Changeset: 476bd8572dfd for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=476bd8572dfd
Modified Files:
        gdk/gdk_search.c
Branch: default
Log Message:

Added special case for binary search in VOID-nil BATs.


diffs (40 lines):

diff --git a/gdk/gdk_search.c b/gdk/gdk_search.c
--- a/gdk/gdk_search.c
+++ b/gdk/gdk_search.c
@@ -319,6 +319,12 @@ SORTfnd(BAT *b, const void *v)
                        return BUN_NONE;
                return *(oid*)v - b->tseqbase;
        }
+       if (b->ttype == TYPE_void) {
+               assert(b->tseqbase == oid_nil);
+               if (*(const oid *) v == oid_nil)
+                       return 0;
+               return BUN_NONE;
+       }
        return binsearch(NULL, 0, b->ttype, Tloc(b, 0),
                         b->tvheap ? b->tvheap->base : NULL, b->twidth, 0,
                         BATcount(b), v, b->tsorted ? 1 : -1, -1);
@@ -351,6 +357,10 @@ SORTfndfirst(BAT *b, const void *v)
                        return BATcount(b);
                return *(oid*)v - b->tseqbase;
        }
+       if (b->ttype == TYPE_void) {
+               assert(b->tseqbase == oid_nil);
+               return 0;
+       }
        return binsearch(NULL, 0, b->ttype, Tloc(b, 0),
                         b->tvheap ? b->tvheap->base : NULL, b->twidth, 0,
                         BATcount(b), v, b->tsorted ? 1 : -1, 0);
@@ -382,6 +392,12 @@ SORTfndlast(BAT *b, const void *v)
                        return BATcount(b);
                return *(oid*)v - b->tseqbase;
        }
+       if (b->ttype == TYPE_void) {
+               assert(b->tseqbase == oid_nil);
+               if (*(const oid *) v == oid_nil)
+                       return 0;
+               return BATcount(b);
+       }
        return binsearch(NULL, 0, b->ttype, Tloc(b, 0),
                         b->tvheap ? b->tvheap->base : NULL, b->twidth, 0,
                         BATcount(b), v, b->tsorted ? 1 : -1, 1);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to