Changeset: 0f6ff527560d for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0f6ff527560d Modified Files: gdk/gdk_search.c Branch: Oct2014 Log Message:
HASHclear(): use memset() instead of for-loop diffs (39 lines): diff --git a/gdk/gdk_search.c b/gdk/gdk_search.c --- a/gdk/gdk_search.c +++ b/gdk/gdk_search.c @@ -123,28 +123,13 @@ HASHmask(BUN cnt) static void HASHclear(Hash *h) { - BUN i, j = h->mask, nil = HASHnil(h); - - switch (h->width) { - case 1: - for (i = 0; i <= j; i++) - HASHput1(h, i, nil); - break; - case 2: - for (i = 0; i <= j; i++) - HASHput2(h, i, nil); - break; - case 4: - for (i = 0; i <= j; i++) - HASHput4(h, i, nil); - break; -#if SIZEOF_BUN == 8 - case 8: - for (i = 0; i <= j; i++) - HASHput8(h, i, nil); - break; -#endif - } + /* since BUN2_NONE, BUN4_NONE, BUN8_NONE + * are all equal to -1 (~0), i.e., have all bits set, + * we can use a simple memset() to clear the Hash, + * rather than iteratively assigning individual + * BUNi_NONE values in a for-loop + */ + memset(h->Hash, 0xFF, (h->mask + 1) * h->width); } Hash * _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list