Changeset: f17a6eae6a8d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f17a6eae6a8d
Modified Files:
        gdk/gdk_cand.h
Branch: msk-type
Log Message:

Special version of canditer_contains for msk.


diffs (28 lines):

diff --git a/gdk/gdk_cand.h b/gdk/gdk_cand.h
--- a/gdk/gdk_cand.h
+++ b/gdk/gdk_cand.h
@@ -127,7 +127,23 @@ gdk_export oid canditer_idx(struct candi
 gdk_export void canditer_setidx(struct canditer *ci, BUN p);
 gdk_export void canditer_reset(struct canditer *ci);
 gdk_export BUN canditer_search(struct canditer *ci, oid o, bool next);
-#define canditer_contains(ci, o) (canditer_search(ci, o, false) != BUN_NONE)
+static inline bool
+canditer_contains(struct canditer *ci, oid o)
+{
+       if (ci->tpe == cand_mask) {
+               if (o < ci->mskoff)
+                       return false;
+               o -= ci->mskoff;
+               BUN p = o / 32;
+               if (p >= ci->nvals)
+                       return false;
+               o %= 32;
+               if (p == ci->nvals - 1 && o >= ci->lastbit)
+                       return false;
+               return ci->mask[p] & (1U << o);
+       }
+       return canditer_search(ci, o, false) != BUN_NONE;
+}
 gdk_export BAT *canditer_slice(struct canditer *ci, BUN lo, BUN hi);
 gdk_export BAT *canditer_sliceval(struct canditer *ci, oid lo, oid hi);
 gdk_export BAT *canditer_slice2(struct canditer *ci, BUN lo1, BUN hi1, BUN 
lo2, BUN hi2);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to