Changeset: 4aa2f98d989d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4aa2f98d989d
Modified Files:
gdk/gdk.h
gdk/gdk_search.c
Branch: default
Log Message:
use correct NIL / NONE value for new variable BUN size in hash tables
diffs (80 lines):
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -538,15 +538,6 @@ typedef oid var_t; /* type used for hea
#endif
typedef oid BUN; /* BUN position */
-#define BUN1 1
-#define BUN2 2
-#define BUN4 4
-#define BUN8 8
-typedef unsigned char BUN1type;
-typedef unsigned short BUN2type;
-typedef unsigned int BUN4type;
-typedef BUN BUN8type;
-
#define SIZEOF_BUN SIZEOF_OID
#define BUNFMT OIDFMT
/* alternatively:
@@ -561,6 +552,20 @@ 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
+#define BUN8 8
+typedef unsigned char BUN1type;
+typedef unsigned short BUN2type;
+typedef unsigned int BUN4type;
+typedef BUN BUN8type;
+#define BUN1_NONE ((BUN1type) 0xFF)
+#define BUN2_NONE ((BUN2type) 0xFFFF)
+#define BUN4_NONE ((BUN4type) 0xFFFFFFFF)
+#define BUN8_NONE ((BUN8type) BUN_NONE)
+
+
/*
* @- Checking and Error definitions:
*/
diff --git a/gdk/gdk_search.c b/gdk/gdk_search.c
--- a/gdk/gdk_search.c
+++ b/gdk/gdk_search.c
@@ -93,9 +93,9 @@
#include "gdk_private.h"
int HASHwidth(BUN hashsize){
- //if ( hashsize < BUN_NONE/8 ) return BUN1; does not make much sense
- //if ( hashsize < BUN_NONE/4 ) return BUN2;
- if ( hashsize < BUN_NONE/2) return BUN4;
+ //if (hashsize < BUN1_NONE) return BUN1; does not make much sense
+ //if (hashsize < BUN2_NONE) return BUN2;
+ if (hashsize < BUN4_NONE) return BUN4;
(void) hashsize;
return BUN8;
}
@@ -135,7 +135,22 @@ HASHnew(Heap *hp, int tpe, BUN size, BUN
h->lim = size;
h->mask = mask - 1;
h->width = width;
- h->nil = (BUN) h->mask;
+ switch (width) {
+ case BUN1:
+ h->nil = BUN1_NONE;
+ break;
+ case BUN2:
+ h->nil = BUN2_NONE;
+ break;
+ case BUN4:
+ h->nil = BUN4_NONE;
+ break;
+ case BUN8:
+ h->nil = BUN8_NONE;
+ break;
+ default:
+ assert(0);
+ }
h->link = (BUN *) hp->base;
h->hash = (BUN *) ((char*)h->link + h->lim *width);
h->type = tpe;
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list