Lines Matching defs:key
199 ** The inttable uses uintptr_t as its key, which guarantees it can be used to
600 * 1. an actual integer key, or
608 UPB_INLINE char *upb_tabstr(upb_tabkey key, uint32_t *len) {
609 char* mem = (char*)key;
626 upb_tabkey key;
672 return e->key == 0;
676 uint32_t upb_murmur_hash2(const void * key, size_t len, uint32_t seed);
678 UPB_INLINE uintptr_t upb_intkey(uintptr_t key) {
679 return key;
682 UPB_INLINE uint32_t upb_inthash(uintptr_t key) {
683 return (uint32_t)key;
690 UPB_INLINE bool upb_arrhas(upb_tabval key) {
691 return key.val != (uint64_t)-1;
731 /* Inserts the given key into the hashtable with the given value. The key must
732 * not already exist in the hash table. For string tables, the key must be
733 * NULL-terminated, and the table will make an internal copy of the key.
738 bool upb_inttable_insert2(upb_inttable *t, uintptr_t key, upb_value val,
740 bool upb_strtable_insert3(upb_strtable *t, const char *key, size_t len,
743 UPB_INLINE bool upb_inttable_insert(upb_inttable *t, uintptr_t key,
745 return upb_inttable_insert2(t, key, val, &upb_alloc_global);
748 UPB_INLINE bool upb_strtable_insert2(upb_strtable *t, const char *key,
750 return upb_strtable_insert3(t, key, len, val, &upb_alloc_global);
754 UPB_INLINE bool upb_strtable_insert(upb_strtable *t, const char *key,
756 return upb_strtable_insert2(t, key, strlen(key), val);
759 /* Looks up key in this table, returning "true" if the key was found.
760 * If v is non-NULL, copies the value for this key into *v. */
761 bool upb_inttable_lookup(const upb_inttable *t, uintptr_t key, upb_value *v);
762 bool upb_strtable_lookup2(const upb_strtable *t, const char *key, size_t len,
766 UPB_INLINE bool upb_strtable_lookup(const upb_strtable *t, const char *key,
768 return upb_strtable_lookup2(t, key, strlen(key), v);
773 bool upb_inttable_remove(upb_inttable *t, uintptr_t key, upb_value *val);
774 bool upb_strtable_remove3(upb_strtable *t, const char *key, size_t len,
777 UPB_INLINE bool upb_strtable_remove2(upb_strtable *t, const char *key,
779 return upb_strtable_remove3(t, key, len, val, &upb_alloc_global);
783 UPB_INLINE bool upb_strtable_remove(upb_strtable *t, const char *key,
785 return upb_strtable_remove2(t, key, strlen(key), v);
791 bool upb_inttable_replace(upb_inttable *t, uintptr_t key, upb_value val);
803 bool upb_inttable_insertptr2(upb_inttable *t, const void *key, upb_value val,
805 bool upb_inttable_removeptr(upb_inttable *t, const void *key, upb_value *val);
807 const upb_inttable *t, const void *key, upb_value *val);
809 UPB_INLINE bool upb_inttable_insertptr(upb_inttable *t, const void *key,
811 return upb_inttable_insertptr2(t, key, val, &upb_alloc_global);
825 UPB_INLINE bool upb_inttable_lookup32(const upb_inttable *t, uint32_t key,
828 if (key < t->array_size) {
829 upb_tabval arrval = t->array[key];
839 for (e = upb_getentry(&t->t, upb_inthash(key)); true; e = e->next) {
840 if ((uint32_t)e->key == key) {
881 * const char *key = upb_strtable_iter_key(&i);
907 * uintptr_t key = upb_inttable_iter_key(&i);
1126 /* Size of key and val, based on the map type. Strings are represented as '0'
1149 /* Creates a new map on the given arena with this key/value type. */
1161 UPB_INLINE upb_strview _upb_map_tokey(const void *key, size_t size) {
1163 return *(upb_strview*)key;
1165 return upb_strview_make((const char*)key, size);
1169 UPB_INLINE void _upb_map_fromkey(upb_strview key, void* out, size_t size) {
1171 memcpy(out, &key, sizeof(key));
1173 memcpy(out, key.data, size);
1205 UPB_INLINE bool _upb_map_get(const upb_map *map, const void *key,
1208 upb_strview k = _upb_map_tokey(key, key_size);
1226 UPB_INLINE bool _upb_map_set(upb_map *map, const void *key, size_t key_size,
1228 upb_strview strkey = _upb_map_tokey(key, key_size);
1237 UPB_INLINE bool _upb_map_delete(upb_map *map, const void *key, size_t key_size) {
1238 upb_strview k = _upb_map_tokey(key, key_size);
1254 const void *key, size_t key_size, void *val,
1258 return _upb_map_get(map, key, key_size, val, val_size);
1268 UPB_INLINE bool _upb_msg_map_set(upb_msg *msg, size_t ofs, const void *key,
1275 return _upb_map_set(*map, key, key_size, val, val_size, arena);
1278 UPB_INLINE bool _upb_msg_map_delete(upb_msg *msg, size_t ofs, const void *key,
1282 return _upb_map_delete(map, key, key_size);
1291 /* Accessing map key/value from a pointer, used by generated code only. */
1293 UPB_INLINE void _upb_msg_map_key(const void* msg, void* key, size_t size) {
1297 k.data = upb_tabstr(ent->key, &u32len);
1299 _upb_map_fromkey(k, key, size);
3504 /* Creates a new map on the given arena with the given key/value size. */
3511 /* Stores a value for the given key into |*val| (or the zero value if the key is
3512 * not present). Returns whether the key was present. The |val| pointer may be
3513 * NULL, in which case the function tests whether the given key is present. */
3514 bool upb_map_get(const upb_map *map, upb_msgval key, upb_msgval *val);
3519 /* Sets the given key to the given value. Returns true if this was a new key in
3520 * the map, or false if an existing key was replaced. */
3521 bool upb_map_set(upb_map *map, upb_msgval key, upb_msgval val,
3524 /* Deletes this key from the table. Returns true if the key was present. */
3525 bool upb_map_delete(upb_map *map, upb_msgval key);
3531 * upb_msgval key = upb_mapiter_key(map, iter);
3542 /* Returns the key and value for this entry of the map. */
6201 * could key the table on fieldnum+wiretype, the table would be 8x sparser.