summaryrefslogtreecommitdiff
path: root/include/engine
diff options
context:
space:
mode:
Diffstat (limited to 'include/engine')
-rw-r--r--include/engine/ttable.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/include/engine/ttable.h b/include/engine/ttable.h
index 8b1938a..e1a10f1 100644
--- a/include/engine/ttable.h
+++ b/include/engine/ttable.h
@@ -5,9 +5,6 @@
#include "bitboard.h"
#include <stdatomic.h>
-#define TABLE_BITS 24
-#define TABLE_SIZE (1ULL << TABLE_BITS)
-#define TT_MASK (TABLE_SIZE - 1)
#define TT_BUCKET_SIZE 4
static struct zobrist_keys {
@@ -33,10 +30,13 @@ typedef struct {
typedef struct {
tentry_t entries[TT_BUCKET_SIZE];
- int items_filled;
+ // int items_filled;
} tbucket_t;
-typedef tbucket_t* ttable_t;
+typedef struct {
+ tbucket_t* buckets;
+ u64 mask;
+} ttable_t;
struct ttable_insert_args {
u64 key;
@@ -48,7 +48,10 @@ struct ttable_insert_args {
u8 flag;
};
-void ttable_init(ttable_t *table);
+// if you want size 8, then size_in_binary_log = 3
+// if you want size 4, then size_in_binary_log = 2
+// you are forced to have powers of 2 for size
+void ttable_init(ttable_t *table, size_t size_in_binary_log);
void ttable_deinit(ttable_t table);
void __ttable_insert(ttable_t table, struct ttable_insert_args args);
tentry_t *ttable_find(ttable_t table, u64 key);