summaryrefslogtreecommitdiff
path: root/src/upb_table.h
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2011-02-17 23:07:17 -0800
committerJoshua Haberman <joshua@reverberate.org>2011-02-17 23:07:17 -0800
commitd8b215486245e84e33283b6047fb253bbb418e00 (patch)
tree4c07a4d3162a0390be0b55d619ddab0e7a6acb23 /src/upb_table.h
parentf1e1cc4695b34b292454e903adbf09e66cf2e9d5 (diff)
First version of an assembly language decoder.
It is slower than the C decoder for now because it falls off the fast path too often. But it can successfully decode varints, fixed32 and fixed64.
Diffstat (limited to 'src/upb_table.h')
-rw-r--r--src/upb_table.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/upb_table.h b/src/upb_table.h
index 3903c75..c658a6e 100644
--- a/src/upb_table.h
+++ b/src/upb_table.h
@@ -123,18 +123,21 @@ INLINE void *_upb_inttable_fastlookup(upb_inttable *t, uint32_t key,
upb_inttable_value *arrval =
(upb_inttable_value*)UPB_INDEX(t->array, key, value_size);
if (_upb_inttable_isarrkey(t, key)) {
- //printf("array lookup for key %d, &val=%p, has_entry=%d\n", key, val, val->has_entry);
+ //DEBUGPRINTF("array lookup for key %d, &val=%p, has_entry=%d\n", key, val, val->has_entry);
return (arrval->has_entry) ? arrval : NULL;
}
uint32_t bucket = _upb_inttable_bucket(t, key);
upb_inttable_entry *e =
(upb_inttable_entry*)UPB_INDEX(t->t.entries, bucket, entry_size);
- //printf("looking in first bucket %d, entry size=%zd, addr=%p\n", bucket, entry_size, e);
+ //DEBUGPRINTF("looking in first bucket %d, entry size=%zd, addr=%p\n", bucket, entry_size, e);
while (1) {
- //printf("%d, %d, %d\n", e->val.has_entry, e->hdr.key, key);
- if (e->hdr.key == key) return &e->val;
+ //DEBUGPRINTF("%d, %d, %d\n", e->val.has_entry, e->hdr.key, key);
+ if (e->hdr.key == key) {
+ DEBUGPRINTF("returning val from hash part\n");
+ return &e->val;
+ }
if ((bucket = e->hdr.next) == UPB_END_OF_CHAIN) return NULL;
- //printf("looking in bucket %d\n", bucket);
+ //DEBUGPRINTF("looking in bucket %d\n", bucket);
e = (upb_inttable_entry*)UPB_INDEX(t->t.entries, bucket, entry_size);
}
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback