Auto-generate files after cl/595002227
diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h index dfa9ffe..302e9c2 100755 --- a/ruby/ext/google/protobuf_c/ruby-upb.h +++ b/ruby/ext/google/protobuf_c/ruby-upb.h
@@ -4106,8 +4106,8 @@ // - '1' for one-byte tags (field numbers 1-15) // - '2' for two-byte tags (field numbers 16-2048) -#ifndef UPB_WIRE_DECODE_INTERNAL_FAST_H_ -#define UPB_WIRE_DECODE_INTERNAL_FAST_H_ +#ifndef UPB_WIRE_INTERNAL_DECODE_FAST_H_ +#define UPB_WIRE_INTERNAL_DECODE_FAST_H_ // Must be last. @@ -4175,6 +4175,7 @@ TAGBYTES(r) #undef F +#undef UTF8 #undef TAGBYTES /* sub-message fields *********************************************************/ @@ -4197,9 +4198,9 @@ TAGBYTES(o) TAGBYTES(r) -#undef TAGBYTES -#undef SIZES #undef F +#undef SIZES +#undef TAGBYTES #undef UPB_PARSE_PARAMS @@ -4208,7 +4209,7 @@ #endif -#endif /* UPB_WIRE_DECODE_INTERNAL_FAST_H_ */ +#endif /* UPB_WIRE_INTERNAL_DECODE_FAST_H_ */ // IWYU pragma: end_exports #endif // UPB_GENERATED_CODE_SUPPORT_H_ @@ -12714,6 +12715,44 @@ #endif /* UPB_HASH_INT_TABLE_H_ */ +#ifndef UPB_BASE_INTERNAL_ENDIAN_H_ +#define UPB_BASE_INTERNAL_ENDIAN_H_ + +#include <stdint.h> + +// Must be last. + +#ifdef __cplusplus +extern "C" { +#endif + +UPB_INLINE bool upb_IsLittleEndian(void) { + const int x = 1; + return *(char*)&x == 1; +} + +UPB_INLINE uint32_t upb_BigEndian32(uint32_t val) { + if (upb_IsLittleEndian()) return val; + + return ((val & 0xff) << 24) | ((val & 0xff00) << 8) | + ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24); +} + +UPB_INLINE uint64_t upb_BigEndian64(uint64_t val) { + if (upb_IsLittleEndian()) return val; + + const uint64_t hi = ((uint64_t)upb_BigEndian32((uint32_t)val)) << 32; + const uint64_t lo = upb_BigEndian32((uint32_t)(val >> 32)); + return hi | lo; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* UPB_BASE_INTERNAL_ENDIAN_H_ */ + #ifndef UPB_WIRE_INTERNAL_CONSTANTS_H_ #define UPB_WIRE_INTERNAL_CONSTANTS_H_ @@ -12850,43 +12889,6 @@ #endif /* UPB_WIRE_INTERNAL_DECODER_H_ */ -#ifndef UPB_WIRE_INTERNAL_ENDIAN_H_ -#define UPB_WIRE_INTERNAL_ENDIAN_H_ - -#include <stdint.h> - -// Must be last. - -#ifdef __cplusplus -extern "C" { -#endif - -UPB_INLINE bool UPB_PRIVATE(_upb_IsLittleEndian)(void) { - const int x = 1; - return *(char*)&x == 1; -} - -UPB_INLINE uint32_t UPB_PRIVATE(_upb_BigEndian32)(uint32_t val) { - if (UPB_PRIVATE(_upb_IsLittleEndian)()) return val; - - return ((val & 0xff) << 24) | ((val & 0xff00) << 8) | - ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24); -} - -UPB_INLINE uint64_t UPB_PRIVATE(_upb_BigEndian64)(uint64_t val) { - if (UPB_PRIVATE(_upb_IsLittleEndian)()) return val; - - return ((uint64_t)UPB_PRIVATE(_upb_BigEndian32)((uint32_t)val) << 32) | - UPB_PRIVATE(_upb_BigEndian32)((uint32_t)(val >> 32)); -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif /* UPB_WIRE_INTERNAL_ENDIAN_H_ */ - #ifndef UPB_WIRE_READER_H_ #define UPB_WIRE_READER_H_ @@ -13034,7 +13036,7 @@ UPB_INLINE const char* upb_WireReader_ReadFixed32(const char* ptr, void* val) { uint32_t uval; memcpy(&uval, ptr, 4); - uval = UPB_PRIVATE(_upb_BigEndian32)(uval); + uval = upb_BigEndian32(uval); memcpy(val, &uval, 4); return ptr + 4; } @@ -13047,7 +13049,7 @@ UPB_INLINE const char* upb_WireReader_ReadFixed64(const char* ptr, void* val) { uint64_t uval; memcpy(&uval, ptr, 8); - uval = UPB_PRIVATE(_upb_BigEndian64)(uval); + uval = upb_BigEndian64(uval); memcpy(val, &uval, 8); return ptr + 8; }