62 lines
1.7 KiB
C
62 lines
1.7 KiB
C
#ifndef GUF_DICT_IMPL_H
|
|
#define GUF_DICT_IMPL_H
|
|
|
|
#include "guf_common.h"
|
|
#include "guf_cstr.h"
|
|
#include "guf_str.h"
|
|
|
|
#include "guf_hash.h"
|
|
|
|
#define GUF_DICT_KEY_T guf_cstr_const
|
|
#define GUF_DICT_KEY_HASH guf_cstr_const_hash
|
|
#define GUF_DICT_KEY_T_EQ guf_cstr_const_eq
|
|
#define GUF_DICT_VAL_T int
|
|
#define GUF_DICT_VAL_T_IS_INTEGRAL_TYPE
|
|
#define GUF_DICT_NAME dict_cstr_int
|
|
#include "guf_dict.h"
|
|
|
|
#define GUF_DICT_KEY_T guf_str_view
|
|
#define GUF_DICT_KEY_HASH guf_str_view_hash
|
|
#define GUF_DICT_KEY_T_EQ guf_str_view_equal
|
|
#define GUF_DICT_VAL_T int32_t
|
|
#define GUF_DICT_VAL_T_IS_INTEGRAL_TYPE
|
|
#define GUF_DICT_NAME dict_sv_i32
|
|
// #define GUF_DICT_64_BIT_IDX
|
|
// #define GUF_DICT_PROBE_LINEAR
|
|
// #define GUF_DICT_32_BIT_HASH
|
|
#include "guf_dict.h"
|
|
|
|
#define GUF_DICT_KEY_T guf_str
|
|
#define GUF_DICT_KEY_HASH guf_str_hash
|
|
#define GUF_DICT_KEY_T_EQ guf_str_equal
|
|
#define GUF_DICT_KEY_T_CMP guf_str_cmp
|
|
#define GUF_DICT_KEY_T_COPY guf_str_copy
|
|
#define GUF_DICT_KEY_T_MOVE guf_str_move
|
|
#define GUF_DICT_KEY_T_FREE guf_str_free
|
|
#define GUF_DICT_VAL_T int32_t
|
|
#define GUF_DICT_VAL_T_IS_INTEGRAL_TYPE
|
|
#define GUF_DICT_NAME dict_str_i32
|
|
// #define GUF_DICT_64_BIT_IDX
|
|
// #define GUF_DICT_PROBE_LINEAR
|
|
// #define GUF_DICT_32_BIT_HASH
|
|
#include "guf_dict.h"
|
|
|
|
static inline guf_hash_size_t int32_hash(const int32_t *a)
|
|
{
|
|
return guf_hash(a, sizeof(int32_t), GUF_HASH_INIT); // TODO: byte order...
|
|
}
|
|
static inline bool int32_eq(const int32_t *a, const int32_t *b)
|
|
{
|
|
return *a == *b;
|
|
}
|
|
|
|
#define GUF_DICT_KEY_T int32_t
|
|
#define GUF_DICT_KEY_HASH int32_hash
|
|
#define GUF_DICT_KEY_T_EQ int32_eq
|
|
#define GUF_DICT_VAL_T bool
|
|
#define GUF_DICT_VAL_T_IS_INTEGRAL_TYPE
|
|
#define GUF_DICT_NAME dict_i32_bool
|
|
#include "guf_dict.h"
|
|
|
|
#endif
|