Move map into md.h asn md_impl.c.

This commit is contained in:
Miguel Lechon
2021-03-16 11:28:41 +01:00
parent 7645afbcc1
commit 55943b79fc
4 changed files with 100 additions and 210 deletions
+27 -18
View File
@@ -384,32 +384,41 @@ typedef enum MD_MessageKind
}
MD_MessageKind;
//~ String-To-Node table
#if 0
typedef enum MD_NodeTableCollisionRule
{
MD_NodeTableCollisionRule_Chain,
MD_NodeTableCollisionRule_Overwrite,
}
MD_NodeTableCollisionRule;
//~ String-To-Ptr and Ptr-To-Ptr tables
typedef struct MD_NodeTableSlot MD_NodeTableSlot;
struct MD_NodeTableSlot
typedef enum MD_MapCollisionRule
{
MD_NodeTableSlot *next;
MD_MapCollisionRule_Chain,
MD_MapCollisionRule_Overwrite,
}
MD_MapCollisionRule;
typedef struct MD_MapSlot MD_MapSlot;
struct MD_MapSlot
{
MD_MapSlot *next;
MD_u64 hash;
MD_Node *node;
void *value;
};
typedef struct MD_NodeTable MD_NodeTable;
struct MD_NodeTable
typedef struct MD_Map MD_Map;
struct MD_Map
{
MD_u64 table_size;
MD_NodeTableSlot **table;
MD_MapSlot **table;
};
#else
#include "map_proposal.h"
#endif
/////////////////////////////////////////////
//~ NOTE(mal): Helpers
typedef MD_Map MD_StringMap;
typedef MD_Map MD_PtrMap;
// NOTE(mal): MD_NodeTable interface
typedef MD_Map MD_NodeTable;
typedef MD_MapSlot MD_NodeTableSlot;
typedef MD_MapCollisionRule MD_NodeTableCollisionRule;
#define MD_NodeTableCollisionRule_Chain MD_MapCollisionRule_Chain
#define MD_NodeTableCollisionRule_Overwrite MD_MapCollisionRule_Overwrite
//~ Token kinds.