diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2018-12-24 12:01:36 -0800 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2018-12-24 12:01:36 -0800 |
commit | 45d61f42990d2823a914680098c0e24c15ebf396 (patch) | |
tree | 59af1c21fc7c7ee90f5134c981f1b75c8044b3fe /upb/generated_util.h | |
parent | a3a02d63190c99d6b53545ef23f6aa3671c2e8c0 (diff) | |
parent | c3011c15483b775123ff40d58fe8c29f93efa431 (diff) |
Merge branch 'arrayapi' into defcleanup
Diffstat (limited to 'upb/generated_util.h')
-rw-r--r-- | upb/generated_util.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/upb/generated_util.h b/upb/generated_util.h index edd7298..3907483 100644 --- a/upb/generated_util.h +++ b/upb/generated_util.h @@ -85,6 +85,14 @@ UPB_INLINE bool _upb_has_field(const void *msg, size_t idx) { return (*PTR_AT(msg, idx / 8, const char) & (1 << (idx % 8))) != 0; } +UPB_INLINE bool _upb_sethas(const void *msg, size_t idx) { + return (*PTR_AT(msg, idx / 8, char)) |= (1 << (idx % 8)); +} + +UPB_INLINE bool _upb_clearhas(const void *msg, size_t idx) { + return (*PTR_AT(msg, idx / 8, char)) &= ~(1 << (idx % 8)); +} + UPB_INLINE bool _upb_has_oneof_field(const void *msg, size_t case_ofs, int32_t num) { return *PTR_AT(msg, case_ofs, int32_t) == num; } |