diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2018-08-21 14:18:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-21 14:18:53 -0700 |
commit | e3eae33fb5840dbec3c2bc9109fa164f6066baa8 (patch) | |
tree | 34690021d5688e2b9cd75982a0d1de2451f042d2 /upb/handlers.h | |
parent | b0a6602fc8fddf71ac959d43b4cd82707e6235b9 (diff) | |
parent | 636b25be8d2744bc5fe41b44d36580460aa7b611 (diff) |
Merge pull request #114 from haberman/arenaonly
Enforced that upb_msg lives in an Arena only, and other simplifying.
Diffstat (limited to 'upb/handlers.h')
-rw-r--r-- | upb/handlers.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/upb/handlers.h b/upb/handlers.h index 993af13..a4e2a04 100644 --- a/upb/handlers.h +++ b/upb/handlers.h @@ -799,6 +799,34 @@ UPB_INLINE upb_selector_t upb_handlers_getendselector(upb_selector_t start) { uint32_t upb_handlers_selectorbaseoffset(const upb_fielddef *f); uint32_t upb_handlers_selectorcount(const upb_fielddef *f); + +/** Message handlers ******************************************************************/ + +/* These are the handlers used internally by upb_msgfactory_getmergehandlers(). + * They write scalar data to a known offset from the message pointer. + * + * These would be trivial for anyone to implement themselves, but it's better + * to use these because some JITs will recognize and specialize these instead + * of actually calling the function. */ + +/* Sets a handler for the given primitive field that will write the data at the + * given offset. If hasbit > 0, also sets a hasbit at the given bit offset + * (addressing each byte low to high). */ +bool upb_msg_setscalarhandler(upb_handlers *h, + const upb_fielddef *f, + size_t offset, + int32_t hasbit); + +/* If the given handler is a msghandlers_primitive field, returns true and sets + * *type, *offset and *hasbit. Otherwise returns false. */ +bool upb_msg_getscalarhandlerdata(const upb_handlers *h, + upb_selector_t s, + upb_fieldtype_t *type, + size_t *offset, + int32_t *hasbit); + + + UPB_END_EXTERN_C #include "upb/handlers-inl.h" |