summaryrefslogtreecommitdiff
path: root/upb
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2018-12-24 12:01:11 -0800
committerJoshua Haberman <jhaberman@gmail.com>2018-12-24 12:01:11 -0800
commitc3011c15483b775123ff40d58fe8c29f93efa431 (patch)
tree1aa55cbe08f67e751fe38fd4ebc97c10e90f7aa7 /upb
parent618981a60f2668c4c0ffc59833945514eb3dfdfa (diff)
Fixed bug: make proto2 setters set hasbit.
Diffstat (limited to 'upb')
-rw-r--r--upb/generated_util.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/upb/generated_util.h b/upb/generated_util.h
index 5d6ccb4..4982236 100644
--- a/upb/generated_util.h
+++ b/upb/generated_util.h
@@ -84,6 +84,14 @@ UPB_INLINE bool _upb_has_field(const void *msg, size_t idx) {
return (*PTR_AT(msg, idx / 8, const char) & (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;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback