mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Implemented and tested literal dictionary
This commit is contained in:
25
source/literal_dictionary.h
Normal file
25
source/literal_dictionary.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "common.h"
|
||||
#include "literal.h"
|
||||
|
||||
//TODO: benchmark this
|
||||
#define DICTIONARY_MAX_LOAD 0.75
|
||||
|
||||
typedef struct _entry {
|
||||
Literal key;
|
||||
Literal value;
|
||||
} _entry;
|
||||
|
||||
typedef struct LiteralDictionary {
|
||||
_entry* entries;
|
||||
int capacity;
|
||||
int count;
|
||||
} LiteralDictionary;
|
||||
|
||||
void initLiteralDictionary(LiteralDictionary* dictionary);
|
||||
void freeLiteralDictionary(LiteralDictionary* dictionary);
|
||||
|
||||
void setLiteralDictionary(LiteralDictionary* dictionary, Literal key, Literal value);
|
||||
Literal getLiteralDictionary(LiteralDictionary* dictionary, Literal key);
|
||||
void removeLiteralDictionary(LiteralDictionary* dictionary, Literal key);
|
||||
Reference in New Issue
Block a user