Classes | Macros | Typedefs | Functions | Variables
table.c File Reference
#include <string.h>
#include "upb/table_internal.h"
#include "upb/port_def.inc"
Include dependency graph for table.c:

Go to the source code of this file.

Classes

union  lookupkey_t
 

Macros

#define ARRAY_SIZE(x)   ((sizeof(x) / sizeof(0 [x])) / ((size_t)(!(sizeof(x) % sizeof(0 [x])))))
 
#define UPB_MAXARRSIZE   16 /* 64k. */
 

Typedefs

typedef bool eqlfunc_t(upb_tabkey k1, lookupkey_t k2)
 
typedef uint32_t hashfunc_t(upb_tabkey key)
 

Functions

uint32_t _upb_Hash (const void *p, size_t n, uint64_t seed)
 
static uint32_t _upb_Hash_NoSeed (const char *p, size_t n)
 
static upb_value _upb_value_val (uint64_t val)
 
static size_t begin (const upb_table *t)
 
static void check (upb_inttable *t)
 
static upb_tabentemptyent (upb_table *t, upb_tabent *e)
 
static const upb_tabentfindentry (const upb_table *t, lookupkey_t key, uint32_t hash, eqlfunc_t *eql)
 
static upb_tabentfindentry_mutable (upb_table *t, lookupkey_t key, uint32_t hash, eqlfunc_t *eql)
 
static upb_tabentgetentry_mutable (upb_table *t, uint32_t hash)
 
static bool init (upb_table *t, uint8_t size_lg2, upb_Arena *a)
 
static void insert (upb_table *t, lookupkey_t key, upb_tabkey tabkey, upb_value val, uint32_t hash, hashfunc_t *hashfunc, eqlfunc_t *eql)
 
static upb_tabval int_arrent (const upb_inttable_iter *i)
 
static const upb_tabentint_tabent (const upb_inttable_iter *i)
 
static bool inteql (upb_tabkey k1, lookupkey_t k2)
 
static uint32_t inthash (upb_tabkey key)
 
static lookupkey_t intkey (uintptr_t key)
 
static upb_tabvalinttable_val (upb_inttable *t, uintptr_t key)
 
static const upb_tabvalinttable_val_const (const upb_inttable *t, uintptr_t key)
 
static bool is_pow2 (uint64_t v)
 
static bool isfull (upb_table *t)
 
static int log2ceil (uint64_t v)
 
static bool lookup (const upb_table *t, lookupkey_t key, upb_value *v, uint32_t hash, eqlfunc_t *eql)
 
static upb_tabvalmutable_array (upb_inttable *t)
 
static size_t next (const upb_table *t, size_t i)
 
static bool rm (upb_table *t, lookupkey_t key, upb_value *val, upb_tabkey *removed, uint32_t hash, eqlfunc_t *eql)
 
static upb_tabkey strcopy (lookupkey_t k2, upb_Arena *a)
 
static bool streql (upb_tabkey k1, lookupkey_t k2)
 
static uint32_t strhash (upb_tabkey key)
 
static lookupkey_t strkey2 (const char *str, size_t len)
 
static uint32_t UnalignedLoad32 (const void *p)
 
static uint64_t UnalignedLoad64 (const void *p)
 
static bool upb_arrhas (upb_tabval key)
 
static const upb_tabentupb_getentry (const upb_table *t, uint32_t hash)
 
static uint32_t upb_inthash (uintptr_t key)
 
void upb_inttable_begin (upb_inttable_iter *i, const upb_inttable *t)
 
void upb_inttable_compact (upb_inttable *t, upb_Arena *a)
 
size_t upb_inttable_count (const upb_inttable *t)
 
bool upb_inttable_done (const upb_inttable_iter *i)
 
bool upb_inttable_init (upb_inttable *t, upb_Arena *a)
 
bool upb_inttable_insert (upb_inttable *t, uintptr_t key, upb_value val, upb_Arena *a)
 
bool upb_inttable_iter_isequal (const upb_inttable_iter *i1, const upb_inttable_iter *i2)
 
uintptr_t upb_inttable_iter_key (const upb_inttable_iter *i)
 
void upb_inttable_iter_setdone (upb_inttable_iter *i)
 
upb_value upb_inttable_iter_value (const upb_inttable_iter *i)
 
bool upb_inttable_lookup (const upb_inttable *t, uintptr_t key, upb_value *v)
 
void upb_inttable_next (upb_inttable_iter *iter)
 
bool upb_inttable_next2 (const upb_inttable *t, uintptr_t *key, upb_value *val, intptr_t *iter)
 
bool upb_inttable_remove (upb_inttable *t, uintptr_t key, upb_value *val)
 
void upb_inttable_removeiter (upb_inttable *t, intptr_t *iter)
 
bool upb_inttable_replace (upb_inttable *t, uintptr_t key, upb_value val)
 
bool upb_inttable_sizedinit (upb_inttable *t, size_t asize, int hsize_lg2, upb_Arena *a)
 
char * upb_strdup2 (const char *s, size_t len, upb_Arena *a)
 
void upb_strtable_begin (upb_strtable_iter *i, const upb_strtable *t)
 
void upb_strtable_clear (upb_strtable *t)
 
bool upb_strtable_done (const upb_strtable_iter *i)
 
bool upb_strtable_init (upb_strtable *t, size_t expected_size, upb_Arena *a)
 
bool upb_strtable_insert (upb_strtable *t, const char *k, size_t len, upb_value v, upb_Arena *a)
 
bool upb_strtable_iter_isequal (const upb_strtable_iter *i1, const upb_strtable_iter *i2)
 
upb_StringView upb_strtable_iter_key (const upb_strtable_iter *i)
 
void upb_strtable_iter_setdone (upb_strtable_iter *i)
 
upb_value upb_strtable_iter_value (const upb_strtable_iter *i)
 
bool upb_strtable_lookup2 (const upb_strtable *t, const char *key, size_t len, upb_value *v)
 
void upb_strtable_next (upb_strtable_iter *i)
 
bool upb_strtable_next2 (const upb_strtable *t, upb_StringView *key, upb_value *val, intptr_t *iter)
 
bool upb_strtable_remove2 (upb_strtable *t, const char *key, size_t len, upb_value *val)
 
void upb_strtable_removeiter (upb_strtable *t, intptr_t *iter)
 
bool upb_strtable_resize (upb_strtable *t, size_t size_lg2, upb_Arena *a)
 
static uint64_t upb_umul128 (uint64_t v0, uint64_t v1, uint64_t *out_high)
 
static uint64_t Wyhash (const void *data, size_t len, uint64_t seed, const uint64_t salt[])
 
static uint64_t WyhashMix (uint64_t v0, uint64_t v1)
 

Variables

const uint64_t kWyhashSalt [5]
 
static const double MAX_LOAD = 0.85
 
static const double MIN_DENSITY = 0.1
 

Macro Definition Documentation

◆ ARRAY_SIZE

#define ARRAY_SIZE (   x)    ((sizeof(x) / sizeof(0 [x])) / ((size_t)(!(sizeof(x) % sizeof(0 [x])))))

Definition at line 44 of file table.c.

◆ UPB_MAXARRSIZE

#define UPB_MAXARRSIZE   16 /* 64k. */

Definition at line 41 of file table.c.

Typedef Documentation

◆ eqlfunc_t

typedef bool eqlfunc_t(upb_tabkey k1, lookupkey_t k2)

Definition at line 110 of file table.c.

◆ hashfunc_t

typedef uint32_t hashfunc_t(upb_tabkey key)

Definition at line 109 of file table.c.

Function Documentation

◆ _upb_Hash()

uint32_t _upb_Hash ( const void *  p,
size_t  n,
uint64_t  seed 
)

Definition at line 436 of file table.c.

◆ _upb_Hash_NoSeed()

static uint32_t _upb_Hash_NoSeed ( const char *  p,
size_t  n 
)
static

Definition at line 440 of file table.c.

◆ _upb_value_val()

static upb_value _upb_value_val ( uint64_t  val)
static

Definition at line 56 of file table.c.

◆ begin()

static size_t begin ( const upb_table t)
static

Definition at line 284 of file table.c.

◆ check()

static void check ( upb_inttable t)
static

Definition at line 595 of file table.c.

◆ emptyent()

static upb_tabent* emptyent ( upb_table t,
upb_tabent e 
)
static

Definition at line 142 of file table.c.

◆ findentry()

static const upb_tabent* findentry ( const upb_table t,
lookupkey_t  key,
uint32_t  hash,
eqlfunc_t eql 
)
static

Definition at line 159 of file table.c.

◆ findentry_mutable()

static upb_tabent* findentry_mutable ( upb_table t,
lookupkey_t  key,
uint32_t  hash,
eqlfunc_t eql 
)
static

Definition at line 172 of file table.c.

◆ getentry_mutable()

static upb_tabent* getentry_mutable ( upb_table t,
uint32_t  hash 
)
static

Definition at line 155 of file table.c.

◆ init()

static bool init ( upb_table t,
uint8_t  size_lg2,
upb_Arena a 
)
static

Definition at line 124 of file table.c.

◆ insert()

static void insert ( upb_table t,
lookupkey_t  key,
upb_tabkey  tabkey,
upb_value  val,
uint32_t  hash,
hashfunc_t hashfunc,
eqlfunc_t eql 
)
static

Definition at line 191 of file table.c.

◆ int_arrent()

static upb_tabval int_arrent ( const upb_inttable_iter i)
static

Definition at line 773 of file table.c.

◆ int_tabent()

static const upb_tabent* int_tabent ( const upb_inttable_iter i)
static

Definition at line 768 of file table.c.

◆ inteql()

static bool inteql ( upb_tabkey  k1,
lookupkey_t  k2 
)
static

Definition at line 570 of file table.c.

◆ inthash()

static uint32_t inthash ( upb_tabkey  key)
static

Definition at line 568 of file table.c.

◆ intkey()

static lookupkey_t intkey ( uintptr_t  key)
static

Definition at line 103 of file table.c.

◆ inttable_val()

static upb_tabval* inttable_val ( upb_inttable t,
uintptr_t  key 
)
static

Definition at line 576 of file table.c.

◆ inttable_val_const()

static const upb_tabval* inttable_val_const ( const upb_inttable t,
uintptr_t  key 
)
static

Definition at line 586 of file table.c.

◆ is_pow2()

static bool is_pow2 ( uint64_t  v)
static

Definition at line 54 of file table.c.

◆ isfull()

static bool isfull ( upb_table t)
static

Definition at line 122 of file table.c.

◆ log2ceil()

static int log2ceil ( uint64_t  v)
static

Definition at line 62 of file table.c.

◆ lookup()

static bool lookup ( const upb_table t,
lookupkey_t  key,
upb_value v,
uint32_t  hash,
eqlfunc_t eql 
)
static

Definition at line 177 of file table.c.

◆ mutable_array()

static upb_tabval* mutable_array ( upb_inttable t)
static

Definition at line 572 of file table.c.

◆ next()

static size_t next ( const upb_table t,
size_t  i 
)
static

Definition at line 276 of file table.c.

◆ rm()

static bool rm ( upb_table t,
lookupkey_t  key,
upb_value val,
upb_tabkey removed,
uint32_t  hash,
eqlfunc_t eql 
)
static

Definition at line 237 of file table.c.

◆ strcopy()

static upb_tabkey strcopy ( lookupkey_t  k2,
upb_Arena a 
)
static

Definition at line 291 of file table.c.

◆ streql()

static bool streql ( upb_tabkey  k1,
lookupkey_t  k2 
)
static

Definition at line 450 of file table.c.

◆ strhash()

static uint32_t strhash ( upb_tabkey  key)
static

Definition at line 444 of file table.c.

◆ strkey2()

static lookupkey_t strkey2 ( const char *  str,
size_t  len 
)
static

Definition at line 96 of file table.c.

◆ UnalignedLoad32()

static uint32_t UnalignedLoad32 ( const void *  p)
static

Definition at line 309 of file table.c.

◆ UnalignedLoad64()

static uint64_t UnalignedLoad64 ( const void *  p)
static

Definition at line 303 of file table.c.

◆ upb_arrhas()

static bool upb_arrhas ( upb_tabval  key)
static

Definition at line 120 of file table.c.

◆ upb_getentry()

static const upb_tabent* upb_getentry ( const upb_table t,
uint32_t  hash 
)
static

Definition at line 116 of file table.c.

◆ upb_inthash()

static uint32_t upb_inthash ( uintptr_t  key)
static

Definition at line 114 of file table.c.

◆ upb_inttable_begin()

void upb_inttable_begin ( upb_inttable_iter i,
const upb_inttable t 
)

Definition at line 778 of file table.c.

◆ upb_inttable_compact()

void upb_inttable_compact ( upb_inttable t,
upb_Arena a 
)

Definition at line 710 of file table.c.

◆ upb_inttable_count()

size_t upb_inttable_count ( const upb_inttable t)

Definition at line 591 of file table.c.

◆ upb_inttable_done()

bool upb_inttable_done ( const upb_inttable_iter i)

Definition at line 894 of file table.c.

◆ upb_inttable_init()

bool upb_inttable_init ( upb_inttable t,
upb_Arena a 
)

Definition at line 630 of file table.c.

◆ upb_inttable_insert()

bool upb_inttable_insert ( upb_inttable t,
uintptr_t  key,
upb_value  val,
upb_Arena a 
)

Definition at line 634 of file table.c.

◆ upb_inttable_iter_isequal()

bool upb_inttable_iter_isequal ( const upb_inttable_iter i1,
const upb_inttable_iter i2 
)

Definition at line 921 of file table.c.

◆ upb_inttable_iter_key()

uintptr_t upb_inttable_iter_key ( const upb_inttable_iter i)

Definition at line 904 of file table.c.

◆ upb_inttable_iter_setdone()

void upb_inttable_iter_setdone ( upb_inttable_iter i)

Definition at line 915 of file table.c.

◆ upb_inttable_iter_value()

upb_value upb_inttable_iter_value ( const upb_inttable_iter i)

Definition at line 909 of file table.c.

◆ upb_inttable_lookup()

bool upb_inttable_lookup ( const upb_inttable t,
uintptr_t  key,
upb_value v 
)

Definition at line 675 of file table.c.

◆ upb_inttable_next()

void upb_inttable_next ( upb_inttable_iter iter)

Definition at line 785 of file table.c.

◆ upb_inttable_next2()

bool upb_inttable_next2 ( const upb_inttable t,
uintptr_t key,
upb_value val,
intptr_t iter 
)

Definition at line 800 of file table.c.

◆ upb_inttable_remove()

bool upb_inttable_remove ( upb_inttable t,
uintptr_t  key,
upb_value val 
)

Definition at line 689 of file table.c.

◆ upb_inttable_removeiter()

void upb_inttable_removeiter ( upb_inttable t,
intptr_t iter 
)

Definition at line 827 of file table.c.

◆ upb_inttable_replace()

bool upb_inttable_replace ( upb_inttable t,
uintptr_t  key,
upb_value  val 
)

Definition at line 682 of file table.c.

◆ upb_inttable_sizedinit()

bool upb_inttable_sizedinit ( upb_inttable t,
size_t  asize,
int  hsize_lg2,
upb_Arena a 
)

Definition at line 611 of file table.c.

◆ upb_strdup2()

char* upb_strdup2 ( const char *  s,
size_t  len,
upb_Arena a 
)

Definition at line 70 of file table.c.

◆ upb_strtable_begin()

void upb_strtable_begin ( upb_strtable_iter i,
const upb_strtable t 
)

Definition at line 523 of file table.c.

◆ upb_strtable_clear()

void upb_strtable_clear ( upb_strtable t)

Definition at line 465 of file table.c.

◆ upb_strtable_done()

bool upb_strtable_done ( const upb_strtable_iter i)

Definition at line 532 of file table.c.

◆ upb_strtable_init()

bool upb_strtable_init ( upb_strtable t,
size_t  expected_size,
upb_Arena a 
)

Definition at line 456 of file table.c.

◆ upb_strtable_insert()

bool upb_strtable_insert ( upb_strtable t,
const char *  k,
size_t  len,
upb_value  v,
upb_Arena a 
)

Definition at line 486 of file table.c.

◆ upb_strtable_iter_isequal()

bool upb_strtable_iter_isequal ( const upb_strtable_iter i1,
const upb_strtable_iter i2 
)

Definition at line 557 of file table.c.

◆ upb_strtable_iter_key()

upb_StringView upb_strtable_iter_key ( const upb_strtable_iter i)

Definition at line 538 of file table.c.

◆ upb_strtable_iter_setdone()

void upb_strtable_iter_setdone ( upb_strtable_iter i)

Definition at line 552 of file table.c.

◆ upb_strtable_iter_value()

upb_value upb_strtable_iter_value ( const upb_strtable_iter i)

Definition at line 547 of file table.c.

◆ upb_strtable_lookup2()

bool upb_strtable_lookup2 ( const upb_strtable t,
const char *  key,
size_t  len,
upb_value v 
)

Definition at line 508 of file table.c.

◆ upb_strtable_next()

void upb_strtable_next ( upb_strtable_iter i)

Definition at line 528 of file table.c.

◆ upb_strtable_next2()

bool upb_strtable_next2 ( const upb_strtable t,
upb_StringView key,
upb_value val,
intptr_t iter 
)

Definition at line 855 of file table.c.

◆ upb_strtable_remove2()

bool upb_strtable_remove2 ( upb_strtable t,
const char *  key,
size_t  len,
upb_value val 
)

Definition at line 514 of file table.c.

◆ upb_strtable_removeiter()

void upb_strtable_removeiter ( upb_strtable t,
intptr_t iter 
)

Definition at line 871 of file table.c.

◆ upb_strtable_resize()

bool upb_strtable_resize ( upb_strtable t,
size_t  size_lg2,
upb_Arena a 
)

Definition at line 471 of file table.c.

◆ upb_umul128()

static uint64_t upb_umul128 ( uint64_t  v0,
uint64_t  v1,
uint64_t out_high 
)
static

Definition at line 321 of file table.c.

◆ Wyhash()

static uint64_t Wyhash ( const void *  data,
size_t  len,
uint64_t  seed,
const uint64_t  salt[] 
)
static

Definition at line 352 of file table.c.

◆ WyhashMix()

static uint64_t WyhashMix ( uint64_t  v0,
uint64_t  v1 
)
static

Definition at line 346 of file table.c.

Variable Documentation

◆ kWyhashSalt

const uint64_t kWyhashSalt[5]
constexpr
Initial value:
= {
0x243F6A8885A308D3ULL, 0x13198A2E03707344ULL, 0xA4093822299F31D0ULL,
0x082EFA98EC4E6C89ULL, 0x452821E638D01377ULL,
}

Definition at line 431 of file table.c.

◆ MAX_LOAD

const double MAX_LOAD = 0.85
static

Definition at line 47 of file table.c.

◆ MIN_DENSITY

const double MIN_DENSITY = 0.1
static

Definition at line 52 of file table.c.

ULL
#define ULL(x)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream_unittest.cc:57


grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:33