libguf/src/test/guf_dict_impl.h
2025-03-07 10:58:08 +01:00

44 lines
1.1 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
#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);
}
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