diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2017-07-19 01:08:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-19 01:08:54 +0200 |
commit | ae30b4a816a57a8101ce187245edc3050d515c06 (patch) | |
tree | f90b48f78f28071a6514a8f766bb6570ae35f5f1 /upb/upb.h | |
parent | d5167fff744167eca45df65b5b935525778e2886 (diff) | |
parent | 72c333eb037da6fe63358efe9c6dc29547b0ab49 (diff) |
Merge pull request #90 from haberman/gencode3
Added new encoder/decoder that operates on upb_msglayout.
Diffstat (limited to 'upb/upb.h')
-rw-r--r-- | upb/upb.h | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -34,6 +34,9 @@ template <int N> class InlinedEnvironment; #define UPB_INLINE static #endif +/* Hints to the compiler about likely/unlikely branches. */ +#define UPB_LIKELY(x) __builtin_expect((x),1) + /* Define UPB_BIG_ENDIAN manually if you're on big endian and your compiler * doesn't provide these preprocessor symbols. */ #if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) @@ -295,6 +298,16 @@ class PointerBase2 : public PointerBase<T, Base> { #endif +/* A list of types as they are encoded on-the-wire. */ +typedef enum { + UPB_WIRE_TYPE_VARINT = 0, + UPB_WIRE_TYPE_64BIT = 1, + UPB_WIRE_TYPE_DELIMITED = 2, + UPB_WIRE_TYPE_START_GROUP = 3, + UPB_WIRE_TYPE_END_GROUP = 4, + UPB_WIRE_TYPE_32BIT = 5 +} upb_wiretype_t; + /* upb::ErrorSpace ************************************************************/ @@ -623,7 +636,7 @@ void upb_env_uninit(upb_env *e); void upb_env_initonly(upb_env *e); -upb_arena *upb_env_arena(upb_env *e); +UPB_INLINE upb_arena *upb_env_arena(upb_env *e) { return (upb_arena*)e; } bool upb_env_ok(const upb_env *e); void upb_env_seterrorfunc(upb_env *e, upb_error_func *func, void *ud); |