Changeset: bf8deb3624fc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bf8deb3624fc
Modified Files:
gdk/gdk_hash.c
gdk/gdk_private.h
Branch: default
Log Message:
Turn HASHmask into an inline function.
diffs (53 lines):
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -66,28 +66,6 @@ hashmask(BUN m)
return m;
}
-BUN
-HASHmask(BUN cnt)
-{
- BUN m = cnt;
-
-#if 0
- /* find largest power of 2 smaller than or equal to cnt */
- m = hashmask(m);
- m -= m >> 1;
-
- /* if cnt is more than 1/3 into the gap between m and 2*m,
- double m */
- if (m + m - cnt < 2 * (cnt - m))
- m += m;
-#else
- m = m * 8 / 7;
-#endif
- if (m < BATTINY)
- m = BATTINY;
- return m;
-}
-
static inline void
HASHclear(Hash *h)
{
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -199,9 +199,14 @@ BUN HASHinsert(BATiter *bi, BUN p, const
__attribute__((__visibility__("hidden")));
void HASHinsert_locked(BATiter *bi, BUN p, const void *v)
__attribute__((__visibility__("hidden")));
-BUN HASHmask(BUN cnt)
- __attribute__((__const__))
- __attribute__((__visibility__("hidden")));
+static inline BUN __attribute__((__const__))
+HASHmask(BUN cnt)
+{
+ cnt = cnt * 8 / 7;
+ if (cnt < BATTINY)
+ cnt = BATTINY;
+ return cnt;
+}
gdk_return HASHnew(Hash *h, int tpe, BUN size, BUN mask, BUN count, bool
bcktonly)
__attribute__((__visibility__("hidden")));
gdk_return HEAPalloc(Heap *h, size_t nitems, size_t itemsize)
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]