pre-computed identifer hashes

This commit is contained in:
2022-08-11 18:36:03 +01:00
parent 1430aefdf3
commit 00812e7a73
5 changed files with 34 additions and 27 deletions

View File

@@ -36,6 +36,7 @@ typedef struct {
struct { //for variable names
char* ptr;
int length;
int hash;
} identifier;
//TODO: type
@@ -99,7 +100,7 @@ void freeLiteral(Literal literal);
#define STRLEN(lit) ((lit).as.string.length)
#define STRLEN_I(lit) ((lit).as.identifier.length)
#define TYPES(lit) ((lit).as.identifier.types)
#define HASH_I(lit) ((lit).as.identifier.hash)
//BUGFIX: macros are not functions
bool _isTruthy(Literal x);