From 7059be68ae2cbd67fca4a5501d4324d44a3868cc Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 12 Aug 2018 20:51:50 -0700 Subject: Re-add message handlers to upb/handlers.*. These are still being used by the proto2 bindings. --- upb/handlers.h | 28 ++++++++++++++++++++++++++++ upb/msg.h | 26 -------------------------- 2 files changed, 28 insertions(+), 26 deletions(-) (limited to 'upb') 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" diff --git a/upb/msg.h b/upb/msg.h index 17c3e65..5472d17 100644 --- a/upb/msg.h +++ b/upb/msg.h @@ -292,32 +292,6 @@ void upb_mapiter_setdone(upb_mapiter *i); bool upb_mapiter_isequal(const upb_mapiter *i1, const upb_mapiter *i2); -/** 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); - - /** Interfaces for generated code *********************************************/ #define UPB_NOT_IN_ONEOF UINT16_MAX -- cgit v1.2.3