summaryrefslogtreecommitdiff
path: root/src/ht.h
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2022-02-05 17:30:11 +0800
committerJSDurand <mmemmew@gmail.com>2022-02-05 17:30:11 +0800
commit510b10b96b546fcc6c6b6be85050305ddd192a41 (patch)
tree997d6c3f2c0a1ad6e27127d54a94655527e57864 /src/ht.h
parent3fb5430080199a6d92a63f8259fe4a88df9b83ba (diff)
replace some hash table usage by tuples
Previously I used hash tables, which consume too much memory. Now the critical parts are replaced by a new hand-written library called "tuple.h". Now we can easily parse larger inputs. I haven't tested its limits, though.
Diffstat (limited to 'src/ht.h')
-rw-r--r--src/ht.h15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/ht.h b/src/ht.h
index 65ae747..1defb53 100644
--- a/src/ht.h
+++ b/src/ht.h
@@ -1,5 +1,6 @@
#ifndef HT_H
#define HT_H
+#include "pair.h"
#include "util.h"
enum { HT_INIT_CAP = 1 << 8 };
@@ -117,24 +118,12 @@ P_ATTR void *ht_find(CCR_MOD(ht *) htp, void *key);
/* Pairing hash tables */
-struct pair2_s { NUM x; NUM y; };
-
-typedef struct pair2_s pair2;
-
/* On error return NULL */
ht *new_ht2(UNUM size);
-struct pair3_s { NUM x; NUM y; NUM z; };
-
-typedef struct pair3_s pair3;
-
/* On error return NULL */
ht *new_ht3(UNUM size);
-struct pair4_s { NUM x; NUM y; NUM z; NUM w; };
-
-typedef struct pair4_s pair4;
-
ht *new_ht4(UNUM size);
#define NEW_P2(P, X, Y, CLEAN) do { \
@@ -155,7 +144,7 @@ ht *new_ht4(UNUM size);
P->x = X; \
P->y = Y; \
P->z = Z; \
- P->w = W; \
+ P->u = W; \
} while (0)
#endif