27#ifndef UPB_HASH_COMMON_H_
28#define UPB_HASH_COMMON_H_
56#define FUNCS(name, membername, type_t, converter) \
57 UPB_INLINE void upb_value_set##name(upb_value* val, type_t cval) { \
58 val->val = (uint64_t)cval; \
60 UPB_INLINE upb_value upb_value_##name(type_t val) { \
62 upb_value_set##name(&ret, val); \
65 UPB_INLINE type_t upb_value_get##name(upb_value val) { \
66 return (type_t)(converter)val.val; \
69FUNCS(int32, int32, int32_t, int32_t)
70FUNCS(int64, int64, int64_t, int64_t)
71FUNCS(uint32, uint32, uint32_t, uint32_t)
72FUNCS(uint64, uint64, uint64_t, uint64_t)
73FUNCS(
bool, _bool,
bool,
bool)
74FUNCS(cstr, cstr,
char*, uintptr_t)
75FUNCS(uintptr, uptr, uintptr_t, uintptr_t)
77FUNCS(constptr, constptr,
const void*, uintptr_t)
82 memcpy(&val->
val, &cval,
sizeof(cval));
86 memcpy(&val->
val, &cval,
sizeof(cval));
151 memset(&ret, 0,
sizeof(
upb_key));
159 memcpy(&val, &key,
sizeof(val));
#define UPB_ASSERT(expr)
Definition def.inc:329
#define UPB_INLINE
Definition def.inc:144
UPB_INLINE upb_key upb_key_empty(void)
Definition common.h:149
UPB_INLINE upb_StringView upb_key_strview(upb_key key)
Definition common.h:119
UPB_INLINE size_t upb_table_size(const upb_table *t)
Definition common.h:145
UPB_INLINE upb_value upb_value_float(float cval)
Definition common.h:89
struct _upb_tabent upb_tabent
UPB_INLINE bool upb_tabent_isempty(const upb_tabent *e)
Definition common.h:155
uint32_t _upb_Hash(const void *p, size_t n, uint64_t seed)
UPB_INLINE upb_value upb_value_double(double cval)
Definition common.h:95
UPB_INLINE void upb_value_setfloat(upb_value *val, float cval)
Definition common.h:81
UPB_INLINE void upb_value_setdouble(upb_value *val, double cval)
Definition common.h:85
#define FUNCS(name, membername, type_t, converter)
Definition common.h:56
UPB_API_INLINE upb_StringView upb_StringView_FromDataAndSize(const char *data, size_t size)
Definition string_view.h:32
upb_key key
Definition common.h:127
const struct _upb_tabent * next
Definition common.h:133
upb_value val
Definition common.h:126
uint32_t size
Definition common.h:105
const char data[]
Definition common.h:106
Definition string_view.h:23
upb_tabent * entries
Definition common.h:137
uint32_t mask
Definition common.h:142
uint32_t count
Definition common.h:139
uint64_t val
Definition common.h:45
uintptr_t num
Definition common.h:115
const upb_SizePrefixString * str
Definition common.h:116