summaryrefslogtreecommitdiff
path: root/upb/generated_util.h
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2018-12-15 16:17:48 -0800
committerJoshua Haberman <jhaberman@gmail.com>2018-12-15 16:17:48 -0800
commit380558922b661499f4eb43b0463b5a73e5fe87b7 (patch)
treea4784816965ae37e72bde3983c68738d7b0d41a4 /upb/generated_util.h
parent2681a17513be312d1da924a1644f040eb8c1372a (diff)
test_encoder passes! Other tests still need to be fixed.
Diffstat (limited to 'upb/generated_util.h')
-rw-r--r--upb/generated_util.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/upb/generated_util.h b/upb/generated_util.h
index 0a10099..88a983d 100644
--- a/upb/generated_util.h
+++ b/upb/generated_util.h
@@ -16,7 +16,7 @@ UPB_INLINE const void *_upb_array_accessor(const void *msg, size_t ofs,
size_t *size) {
const upb_array *arr = *PTR_AT(msg, ofs, const upb_array*);
if (arr) {
- if (size) *size = arr->size;
+ if (size) *size = arr->len;
return arr->data;
} else {
if (size) *size = 0;
@@ -28,7 +28,7 @@ UPB_INLINE void *_upb_array_mutable_accessor(void *msg, size_t ofs,
size_t *size) {
upb_array *arr = *PTR_AT(msg, ofs, upb_array*);
if (arr) {
- if (size) *size = arr->size;
+ if (size) *size = arr->len;
return arr->data;
} else {
if (size) size = 0;
@@ -66,7 +66,7 @@ UPB_INLINE void *_upb_array_resize_accessor(void *msg, size_t ofs, size_t size,
}
UPB_INLINE bool _upb_has_field(const void *msg, size_t idx) {
- return (*PTR_AT(msg, idx / 8, const char) & (idx % 8)) != 0;
+ return (*PTR_AT(msg, idx / 8, const char) & (1 << (idx % 8))) != 0;
}
UPB_INLINE bool _upb_has_oneof_field(const void *msg, size_t case_ofs, int32_t num) {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback