diff options
author | Joshua Haberman <joshua@reverberate.org> | 2011-02-17 19:14:53 -0800 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2011-02-17 19:14:53 -0800 |
commit | f1e1cc4695b34b292454e903adbf09e66cf2e9d5 (patch) | |
tree | 4536fa1613c054c83b91a0ac1e76759815ceab80 /src/upb.h | |
parent | f9a6f67e275dd6d379ae9428e1c40f43d8d17386 (diff) |
Split inttable into a hash part and an array part.
upb_inttable() now supports a "compact" operation that will
decide on an array size and put all entries with small enough
keys into the array part for faster lookup.
Also exposed the upb_itof_ent structure and put a few useful
values there, so they are one fewer pointer chase away.
Diffstat (limited to 'src/upb.h')
-rw-r--r-- | src/upb.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -29,6 +29,12 @@ extern "C" { #define UPB_MIN(x, y) ((x) < (y) ? (x) : (y)) #define UPB_INDEX(base, i, m) (void*)((char*)(base) + ((i)*(m))) +// Rounds val up to the next multiple of align. +INLINE size_t upb_align_up(size_t val, size_t align) { + return val % align == 0 ? val : val + align - (val % align); +} + + // The maximum that any submessages can be nested. Matches proto2's limit. #define UPB_MAX_NESTING 64 |