summaryrefslogtreecommitdiff
path: root/src/upb.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/upb.h')
-rw-r--r--src/upb.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/upb.h b/src/upb.h
index 837fc52..c5b4310 100644
--- a/src/upb.h
+++ b/src/upb.h
@@ -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
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback