diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2011-05-08 13:05:12 -0700 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2011-05-08 13:05:12 -0700 |
commit | f74534b42ac9ac8b0ff496cb0da83f1201bbf8da (patch) | |
tree | cf20bb7160a6f37cecd5c2cb4222c03b88e4fcde /src/upb_def.h | |
parent | 4a99abba123fc1d2bef62778846a1f27b2012de0 (diff) |
Decoder redesign in preparation for packed fields and start/endseq.
Diffstat (limited to 'src/upb_def.h')
-rw-r--r-- | src/upb_def.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/upb_def.h b/src/upb_def.h index e19aeba..ba1c410 100644 --- a/src/upb_def.h +++ b/src/upb_def.h @@ -117,12 +117,14 @@ struct _upb_fielddef { INLINE bool upb_issubmsgtype(upb_fieldtype_t type) { return type == UPB_TYPE(GROUP) || type == UPB_TYPE(MESSAGE); } -INLINE bool upb_issubmsg(upb_fielddef *f) { - return upb_issubmsgtype(f->type); +INLINE bool upb_isstringtype(upb_fieldtype_t type) { + return type == UPB_TYPE(STRING) || type == UPB_TYPE(BYTES); } -INLINE bool upb_isstring(upb_fielddef *f) { - return f->type == UPB_TYPE(STRING) || f->type == UPB_TYPE(BYTES); +INLINE bool upb_isprimitivetype(upb_fieldtype_t type) { + return !upb_issubmsgtype(type) && !upb_isstringtype(type); } +INLINE bool upb_issubmsg(upb_fielddef *f) { return upb_issubmsgtype(f->type); } +INLINE bool upb_isstring(upb_fielddef *f) { return upb_isstringtype(f->type); } INLINE bool upb_isarray(upb_fielddef *f) { return f->label == UPB_LABEL(REPEATED); } |