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

Remove BUN1 and supporting code.
This variant of hash bucket widths was not used except possibly for
very temporary hash tables in property checking and derivation and in
group and unique.  It would then only be used for small BATs (fewer
than 255 entries) and for those it doesn't really make much of a
difference whether we use double the size.


diffs (172 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -632,19 +632,16 @@ typedef size_t BUN;
 #endif
 #define BUN_MAX (BUN_NONE - 1) /* maximum allowed size of a BAT */
 
-#define BUN1 1
 #define BUN2 2
 #define BUN4 4
 #if SIZEOF_BUN > 4
 #define BUN8 8
 #endif
-typedef uint8_t  BUN1type;
 typedef uint16_t BUN2type;
 typedef uint32_t BUN4type;
 #if SIZEOF_BUN > 4
 typedef uint64_t BUN8type;
 #endif
-#define BUN1_NONE ((BUN1type) 0xFF)
 #define BUN2_NONE ((BUN2type) 0xFFFF)
 #define BUN4_NONE ((BUN4type) 0xFFFFFFFF)
 #if SIZEOF_BUN > 4
diff --git a/gdk/gdk_search.c b/gdk/gdk_search.c
--- a/gdk/gdk_search.c
+++ b/gdk/gdk_search.c
@@ -95,8 +95,6 @@
 static int
 HASHwidth(BUN hashsize)
 {
-       if (hashsize <= (BUN) BUN1_NONE)
-               return BUN1;
        if (hashsize <= (BUN) BUN2_NONE)
                return BUN2;
 #if SIZEOF_BUN <= 4
@@ -148,9 +146,6 @@ HASHnew(Heap *hp, int tpe, BUN size, BUN
        h->mask = mask - 1;
        h->width = width;
        switch (width) {
-       case BUN1:
-               h->nil = (BUN) BUN1_NONE;
-               break;
        case BUN2:
                h->nil = (BUN) BUN2_NONE;
                break;
diff --git a/gdk/gdk_search.h b/gdk/gdk_search.h
--- a/gdk/gdk_search.h
+++ b/gdk/gdk_search.h
@@ -37,10 +37,6 @@ gdk_export BUN HASHlist(Hash *h, BUN i);
 #define HASHnil(H)     (H)->nil
 
 /* play around with h->Hash[i] and h->Link[j] */
-#define HASHget1(h,i)          ((BUN) ((BUN1type*) (h)->Hash)[i])
-#define HASHput1(h,i,v)                (((BUN1type*) (h)->Hash)[i] = 
(BUN1type) (v))
-#define HASHgetlink1(h,i)      ((BUN) ((BUN1type*) (h)->Link)[i])
-#define HASHputlink1(h,i,v)    (((BUN1type*) (h)->Link)[i] = (BUN1type) (v))
 #define HASHget2(h,i)          ((BUN) ((BUN2type*) (h)->Hash)[i])
 #define HASHput2(h,i,v)                (((BUN2type*) (h)->Hash)[i] = 
(BUN2type) (v))
 #define HASHgetlink2(h,i)      ((BUN) ((BUN2type*) (h)->Link)[i])
@@ -58,70 +54,43 @@ gdk_export BUN HASHlist(Hash *h, BUN i);
 
 #if SIZEOF_BUN <= 4
 #define HASHget(h,i)                           \
-       (((h)->width == BUN4 ? HASHget4(h,i) :  \
-         ((h)->width == BUN2 ? HASHget2(h,i) : \
-          HASHget1(h,i))))
+       ((h)->width == BUN4 ? HASHget4(h,i) : HASHget2(h,i))
 #define HASHput(h,i,v)                         \
        do {                                    \
-               switch ((h)->width) {           \
-               case 1:                         \
-                       HASHput1(h,i,v);        \
-                       break;                  \
-               case 2:                         \
+               if ((h)->width == 2) {          \
                        HASHput2(h,i,v);        \
-                       break;                  \
-               case 4:                         \
+               } else {                        \
                        HASHput4(h,i,v);        \
-                       break;                  \
                }                               \
        } while (0)
 #define HASHgetlink(h,i)                               \
-       (((h)->width == BUN4 ? HASHgetlink4(h,i) :      \
-         ((h)->width == BUN2 ? HASHgetlink2(h,i) :     \
-          HASHgetlink1(h,i))))
+       ((h)->width == BUN4 ? HASHgetlink4(h,i) : HASHgetlink2(h,i))
 #define HASHputlink(h,i,v)                     \
        do {                                    \
-               switch ((h)->width) {           \
-               case 1:                         \
-                       HASHputlink1(h,i,v);    \
-                       break;                  \
-               case 2:                         \
+               if ((h)->width == 2) {          \
                        HASHputlink2(h,i,v);    \
-                       break;                  \
-               case 4:                         \
+               } else {                        \
                        HASHputlink4(h,i,v);    \
-                       break;                  \
                }                               \
        } while (0)
 #define HASHputall(h, i, v)                                    \
        do {                                                    \
-               switch ((h)->width) {                           \
-               case 1:                                         \
-                       HASHputlink1(h, i, HASHget1(h, v));     \
-                       HASHput1(h, v, i);                      \
-                       break;                                  \
-               case 2:                                         \
+               if ((h)->width == 2) {                          \
                        HASHputlink2(h, i, HASHget2(h, v));     \
                        HASHput2(h, v, i);                      \
-                       break;                                  \
-               case 4:                                         \
+               } else {                                        \
                        HASHputlink4(h, i, HASHget4(h, v));     \
                        HASHput4(h, v, i);                      \
-                       break;                                  \
                }                                               \
        } while (0)
 #else
 #define HASHget(h,i)                                   \
-       (((h)->width == BUN8 ? HASHget8(h,i) :          \
-         ((h)->width == BUN4 ? HASHget4(h,i) :         \
-          ((h)->width == BUN2 ? HASHget2(h,i) :        \
-           HASHget1(h,i)))))
+       ((h)->width == BUN8 ? HASHget8(h,i) :           \
+        (h)->width == BUN4 ? HASHget4(h,i) :           \
+        HASHget2(h,i))
 #define HASHput(h,i,v)                         \
        do {                                    \
                switch ((h)->width) {           \
-               case 1:                         \
-                       HASHput1(h,i,v);        \
-                       break;                  \
                case 2:                         \
                        HASHput2(h,i,v);        \
                        break;                  \
@@ -134,16 +103,12 @@ gdk_export BUN HASHlist(Hash *h, BUN i);
                }                               \
        } while (0)
 #define HASHgetlink(h,i)                               \
-       (((h)->width == BUN8 ? HASHgetlink8(h,i) :      \
-         ((h)->width == BUN4 ? HASHgetlink4(h,i) :     \
-          ((h)->width == BUN2 ? HASHgetlink2(h,i) :    \
-           HASHgetlink1(h,i)))))
+       ((h)->width == BUN8 ? HASHgetlink8(h,i) :       \
+        (h)->width == BUN4 ? HASHgetlink4(h,i) :       \
+        HASHgetlink2(h,i))
 #define HASHputlink(h,i,v)                     \
        do {                                    \
                switch ((h)->width) {           \
-               case 1:                         \
-                       HASHputlink1(h,i,v);    \
-                       break;                  \
                case 2:                         \
                        HASHputlink2(h,i,v);    \
                        break;                  \
@@ -158,10 +123,6 @@ gdk_export BUN HASHlist(Hash *h, BUN i);
 #define HASHputall(h, i, v)                                    \
        do {                                                    \
                switch ((h)->width) {                           \
-               case 1:                                         \
-                       HASHputlink1(h, i, HASHget1(h, v));     \
-                       HASHput1(h, v, i);                      \
-                       break;                                  \
                case 2:                                         \
                        HASHputlink2(h, i, HASHget2(h, v));     \
                        HASHput2(h, v, i);                      \
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to