diff options
| author | Aargh Rai <aargh.rai+git@gmail.com> | 2026-07-21 22:43:26 +0530 |
|---|---|---|
| committer | Aargh Rai <aargh.rai+git@gmail.com> | 2026-07-21 22:43:26 +0530 |
| commit | e6cead853d66b4ea9ea8d9c6dba33e5a1720a99d (patch) | |
| tree | b9f4957991f30799d3e32b1a8c6143746fbe0110 /include/engine/ttable.h | |
| parent | 1ebaab7b771c4c73be66895515f948ffe2394cc0 (diff) | |
added the remaining ttable tests & fixed bugs
Diffstat (limited to 'include/engine/ttable.h')
| -rw-r--r-- | include/engine/ttable.h | 15 |
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); |
