Auto-generate files after cl/584380544
diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c
index 3009ffe..4c7f542 100644
--- a/php/ext/google/protobuf/php-upb.c
+++ b/php/ext/google/protobuf/php-upb.c
@@ -6044,7 +6044,7 @@
const upb_MiniTable* sub, upb_Arena* arena) {
size_t size = array->size;
upb_Array* cloned_array =
- _upb_Array_New(arena, size, upb_SizeLog2_CType(value_type));
+ _upb_Array_New(arena, size, upb_CType_SizeLg2(value_type));
if (!cloned_array) {
return NULL;
}
@@ -6218,7 +6218,7 @@
// Must be last.
upb_Array* upb_Array_New(upb_Arena* a, upb_CType type) {
- return _upb_Array_New(a, 4, upb_SizeLog2_CType(type));
+ return _upb_Array_New(a, 4, upb_CType_SizeLg2(type));
}
const void* upb_Array_DataPtr(const upb_Array* arr) {
@@ -12992,7 +12992,7 @@
upb_Array* _upb_Decoder_CreateArray(upb_Decoder* d,
const upb_MiniTableField* field) {
const upb_FieldType field_type = field->UPB_PRIVATE(descriptortype);
- const size_t lg2 = upb_SizeLog2_FieldType(field_type);
+ const size_t lg2 = upb_FieldType_SizeLg2(field_type);
upb_Array* ret = _upb_Array_New(&d->arena, 4, lg2);
if (!ret) _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory);
return ret;
diff --git a/php/ext/google/protobuf/php-upb.h b/php/ext/google/protobuf/php-upb.h
index 7f1fbf6..28e821f 100644
--- a/php/ext/google/protobuf/php-upb.h
+++ b/php/ext/google/protobuf/php-upb.h
@@ -1001,9 +1001,77 @@
#ifndef UPB_MINI_TABLE_INTERNAL_FIELD_H_
#define UPB_MINI_TABLE_INTERNAL_FIELD_H_
+#include <stddef.h>
#include <stdint.h>
+#ifndef UPB_MINI_TABLE_INTERNAL_SIZE_LOG2_H_
+#define UPB_MINI_TABLE_INTERNAL_SIZE_LOG2_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+
+// Must be last.
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Return the log2 of the storage size in bytes for a upb_CType
+UPB_INLINE int upb_CType_SizeLg2(upb_CType c_type) {
+ static const int8_t size[] = {
+ 0, // kUpb_CType_Bool
+ 2, // kUpb_CType_Float
+ 2, // kUpb_CType_Int32
+ 2, // kUpb_CType_UInt32
+ 2, // kUpb_CType_Enum
+ UPB_SIZE(2, 3), // kUpb_CType_Message
+ 3, // kUpb_CType_Double
+ 3, // kUpb_CType_Int64
+ 3, // kUpb_CType_UInt64
+ UPB_SIZE(3, 4), // kUpb_CType_String
+ UPB_SIZE(3, 4), // kUpb_CType_Bytes
+ };
+
+ // -1 here because the enum is one-based but the table is zero-based.
+ return size[c_type - 1];
+}
+
+// Return the log2 of the storage size in bytes for a upb_FieldType
+UPB_INLINE int upb_FieldType_SizeLg2(upb_FieldType field_type) {
+ static const int8_t size[] = {
+ 3, // kUpb_FieldType_Double
+ 2, // kUpb_FieldType_Float
+ 3, // kUpb_FieldType_Int64
+ 3, // kUpb_FieldType_UInt64
+ 2, // kUpb_FieldType_Int32
+ 3, // kUpb_FieldType_Fixed64
+ 2, // kUpb_FieldType_Fixed32
+ 0, // kUpb_FieldType_Bool
+ UPB_SIZE(3, 4), // kUpb_FieldType_String
+ UPB_SIZE(2, 3), // kUpb_FieldType_Group
+ UPB_SIZE(2, 3), // kUpb_FieldType_Message
+ UPB_SIZE(3, 4), // kUpb_FieldType_Bytes
+ 2, // kUpb_FieldType_UInt32
+ 2, // kUpb_FieldType_Enum
+ 2, // kUpb_FieldType_SFixed32
+ 3, // kUpb_FieldType_SFixed64
+ 2, // kUpb_FieldType_SInt32
+ 3, // kUpb_FieldType_SInt64
+ };
+
+ // -1 here because the enum is one-based but the table is zero-based.
+ return size[field_type - 1];
+}
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+
+#endif /* UPB_MINI_TABLE_INTERNAL_SIZE_LOG2_H_ */
+
// Must be last.
struct upb_MiniTableField {
@@ -1086,6 +1154,12 @@
UPB_ASSUME(field->presence == 0);
}
+UPB_INLINE size_t
+_upb_MiniTableField_ElemSizeLg2(const struct upb_MiniTableField* field) {
+ return upb_FieldType_SizeLg2(
+ (upb_FieldType)field->UPB_PRIVATE(descriptortype));
+}
+
#ifdef __cplusplus
} /* extern "C" */
#endif
@@ -2153,73 +2227,6 @@
#endif /* UPB_MESSAGE_INTERNAL_H_ */
-#ifndef UPB_MESSAGE_INTERNAL_SIZE_LOG2_H_
-#define UPB_MESSAGE_INTERNAL_SIZE_LOG2_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-
-// Must be last.
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Return the log2 of the storage size in bytes for a upb_CType
-UPB_INLINE int upb_SizeLog2_CType(upb_CType c_type) {
- static const int8_t size[] = {
- 0, // kUpb_CType_Bool
- 2, // kUpb_CType_Float
- 2, // kUpb_CType_Int32
- 2, // kUpb_CType_UInt32
- 2, // kUpb_CType_Enum
- UPB_SIZE(2, 3), // kUpb_CType_Message
- 3, // kUpb_CType_Double
- 3, // kUpb_CType_Int64
- 3, // kUpb_CType_UInt64
- UPB_SIZE(3, 4), // kUpb_CType_String
- UPB_SIZE(3, 4), // kUpb_CType_Bytes
- };
-
- // -1 here because the enum is one-based but the table is zero-based.
- return size[c_type - 1];
-}
-
-// Return the log2 of the storage size in bytes for a upb_FieldType
-UPB_INLINE int upb_SizeLog2_FieldType(upb_FieldType field_type) {
- static const int8_t size[] = {
- 3, // kUpb_FieldType_Double
- 2, // kUpb_FieldType_Float
- 3, // kUpb_FieldType_Int64
- 3, // kUpb_FieldType_UInt64
- 2, // kUpb_FieldType_Int32
- 3, // kUpb_FieldType_Fixed64
- 2, // kUpb_FieldType_Fixed32
- 0, // kUpb_FieldType_Bool
- UPB_SIZE(3, 4), // kUpb_FieldType_String
- UPB_SIZE(2, 3), // kUpb_FieldType_Group
- UPB_SIZE(2, 3), // kUpb_FieldType_Message
- UPB_SIZE(3, 4), // kUpb_FieldType_Bytes
- 2, // kUpb_FieldType_UInt32
- 2, // kUpb_FieldType_Enum
- 2, // kUpb_FieldType_SFixed32
- 3, // kUpb_FieldType_SFixed64
- 2, // kUpb_FieldType_SInt32
- 3, // kUpb_FieldType_SInt64
- };
-
- // -1 here because the enum is one-based but the table is zero-based.
- return size[field_type - 1];
-}
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-
-#endif /* UPB_MESSAGE_INTERNAL_SIZE_LOG2_H_ */
-
// Must be last.
#if defined(__GNUC__) && !defined(__clang__)
@@ -2376,12 +2383,6 @@
UPB_UNREACHABLE();
}
-UPB_INLINE size_t
-_upb_MiniTable_ElementSizeLg2(const upb_MiniTableField* field) {
- return upb_SizeLog2_FieldType(
- (upb_FieldType)field->UPB_PRIVATE(descriptortype));
-}
-
// Here we define universal getter/setter functions for message fields.
// These look very branchy and inefficient, but as long as the MiniTableField
// values are known at compile time, all the branches are optimized away and
@@ -3032,7 +3033,7 @@
_upb_MiniTableField_CheckIsArray(field);
upb_Array* array = upb_Message_GetMutableArray(msg, field);
if (!array) {
- array = _upb_Array_New(arena, 4, _upb_MiniTable_ElementSizeLg2(field));
+ array = _upb_Array_New(arena, 4, _upb_MiniTableField_ElemSizeLg2(field));
// Check again due to: https://godbolt.org/z/7WfaoKG1r
_upb_MiniTableField_CheckIsArray(field);
upb_MessageValue val;
diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c
index 8e6e835..bbb9969 100644
--- a/ruby/ext/google/protobuf_c/ruby-upb.c
+++ b/ruby/ext/google/protobuf_c/ruby-upb.c
@@ -5559,7 +5559,7 @@
const upb_MiniTable* sub, upb_Arena* arena) {
size_t size = array->size;
upb_Array* cloned_array =
- _upb_Array_New(arena, size, upb_SizeLog2_CType(value_type));
+ _upb_Array_New(arena, size, upb_CType_SizeLg2(value_type));
if (!cloned_array) {
return NULL;
}
@@ -5733,7 +5733,7 @@
// Must be last.
upb_Array* upb_Array_New(upb_Arena* a, upb_CType type) {
- return _upb_Array_New(a, 4, upb_SizeLog2_CType(type));
+ return _upb_Array_New(a, 4, upb_CType_SizeLg2(type));
}
const void* upb_Array_DataPtr(const upb_Array* arr) {
@@ -12507,7 +12507,7 @@
upb_Array* _upb_Decoder_CreateArray(upb_Decoder* d,
const upb_MiniTableField* field) {
const upb_FieldType field_type = field->UPB_PRIVATE(descriptortype);
- const size_t lg2 = upb_SizeLog2_FieldType(field_type);
+ const size_t lg2 = upb_FieldType_SizeLg2(field_type);
upb_Array* ret = _upb_Array_New(&d->arena, 4, lg2);
if (!ret) _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory);
return ret;
diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h
index 5c5d5df..cbb3954 100755
--- a/ruby/ext/google/protobuf_c/ruby-upb.h
+++ b/ruby/ext/google/protobuf_c/ruby-upb.h
@@ -1003,9 +1003,77 @@
#ifndef UPB_MINI_TABLE_INTERNAL_FIELD_H_
#define UPB_MINI_TABLE_INTERNAL_FIELD_H_
+#include <stddef.h>
#include <stdint.h>
+#ifndef UPB_MINI_TABLE_INTERNAL_SIZE_LOG2_H_
+#define UPB_MINI_TABLE_INTERNAL_SIZE_LOG2_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+
+// Must be last.
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Return the log2 of the storage size in bytes for a upb_CType
+UPB_INLINE int upb_CType_SizeLg2(upb_CType c_type) {
+ static const int8_t size[] = {
+ 0, // kUpb_CType_Bool
+ 2, // kUpb_CType_Float
+ 2, // kUpb_CType_Int32
+ 2, // kUpb_CType_UInt32
+ 2, // kUpb_CType_Enum
+ UPB_SIZE(2, 3), // kUpb_CType_Message
+ 3, // kUpb_CType_Double
+ 3, // kUpb_CType_Int64
+ 3, // kUpb_CType_UInt64
+ UPB_SIZE(3, 4), // kUpb_CType_String
+ UPB_SIZE(3, 4), // kUpb_CType_Bytes
+ };
+
+ // -1 here because the enum is one-based but the table is zero-based.
+ return size[c_type - 1];
+}
+
+// Return the log2 of the storage size in bytes for a upb_FieldType
+UPB_INLINE int upb_FieldType_SizeLg2(upb_FieldType field_type) {
+ static const int8_t size[] = {
+ 3, // kUpb_FieldType_Double
+ 2, // kUpb_FieldType_Float
+ 3, // kUpb_FieldType_Int64
+ 3, // kUpb_FieldType_UInt64
+ 2, // kUpb_FieldType_Int32
+ 3, // kUpb_FieldType_Fixed64
+ 2, // kUpb_FieldType_Fixed32
+ 0, // kUpb_FieldType_Bool
+ UPB_SIZE(3, 4), // kUpb_FieldType_String
+ UPB_SIZE(2, 3), // kUpb_FieldType_Group
+ UPB_SIZE(2, 3), // kUpb_FieldType_Message
+ UPB_SIZE(3, 4), // kUpb_FieldType_Bytes
+ 2, // kUpb_FieldType_UInt32
+ 2, // kUpb_FieldType_Enum
+ 2, // kUpb_FieldType_SFixed32
+ 3, // kUpb_FieldType_SFixed64
+ 2, // kUpb_FieldType_SInt32
+ 3, // kUpb_FieldType_SInt64
+ };
+
+ // -1 here because the enum is one-based but the table is zero-based.
+ return size[field_type - 1];
+}
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+
+#endif /* UPB_MINI_TABLE_INTERNAL_SIZE_LOG2_H_ */
+
// Must be last.
struct upb_MiniTableField {
@@ -1088,6 +1156,12 @@
UPB_ASSUME(field->presence == 0);
}
+UPB_INLINE size_t
+_upb_MiniTableField_ElemSizeLg2(const struct upb_MiniTableField* field) {
+ return upb_FieldType_SizeLg2(
+ (upb_FieldType)field->UPB_PRIVATE(descriptortype));
+}
+
#ifdef __cplusplus
} /* extern "C" */
#endif
@@ -2155,73 +2229,6 @@
#endif /* UPB_MESSAGE_INTERNAL_H_ */
-#ifndef UPB_MESSAGE_INTERNAL_SIZE_LOG2_H_
-#define UPB_MESSAGE_INTERNAL_SIZE_LOG2_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-
-// Must be last.
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Return the log2 of the storage size in bytes for a upb_CType
-UPB_INLINE int upb_SizeLog2_CType(upb_CType c_type) {
- static const int8_t size[] = {
- 0, // kUpb_CType_Bool
- 2, // kUpb_CType_Float
- 2, // kUpb_CType_Int32
- 2, // kUpb_CType_UInt32
- 2, // kUpb_CType_Enum
- UPB_SIZE(2, 3), // kUpb_CType_Message
- 3, // kUpb_CType_Double
- 3, // kUpb_CType_Int64
- 3, // kUpb_CType_UInt64
- UPB_SIZE(3, 4), // kUpb_CType_String
- UPB_SIZE(3, 4), // kUpb_CType_Bytes
- };
-
- // -1 here because the enum is one-based but the table is zero-based.
- return size[c_type - 1];
-}
-
-// Return the log2 of the storage size in bytes for a upb_FieldType
-UPB_INLINE int upb_SizeLog2_FieldType(upb_FieldType field_type) {
- static const int8_t size[] = {
- 3, // kUpb_FieldType_Double
- 2, // kUpb_FieldType_Float
- 3, // kUpb_FieldType_Int64
- 3, // kUpb_FieldType_UInt64
- 2, // kUpb_FieldType_Int32
- 3, // kUpb_FieldType_Fixed64
- 2, // kUpb_FieldType_Fixed32
- 0, // kUpb_FieldType_Bool
- UPB_SIZE(3, 4), // kUpb_FieldType_String
- UPB_SIZE(2, 3), // kUpb_FieldType_Group
- UPB_SIZE(2, 3), // kUpb_FieldType_Message
- UPB_SIZE(3, 4), // kUpb_FieldType_Bytes
- 2, // kUpb_FieldType_UInt32
- 2, // kUpb_FieldType_Enum
- 2, // kUpb_FieldType_SFixed32
- 3, // kUpb_FieldType_SFixed64
- 2, // kUpb_FieldType_SInt32
- 3, // kUpb_FieldType_SInt64
- };
-
- // -1 here because the enum is one-based but the table is zero-based.
- return size[field_type - 1];
-}
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-
-#endif /* UPB_MESSAGE_INTERNAL_SIZE_LOG2_H_ */
-
// Must be last.
#if defined(__GNUC__) && !defined(__clang__)
@@ -2378,12 +2385,6 @@
UPB_UNREACHABLE();
}
-UPB_INLINE size_t
-_upb_MiniTable_ElementSizeLg2(const upb_MiniTableField* field) {
- return upb_SizeLog2_FieldType(
- (upb_FieldType)field->UPB_PRIVATE(descriptortype));
-}
-
// Here we define universal getter/setter functions for message fields.
// These look very branchy and inefficient, but as long as the MiniTableField
// values are known at compile time, all the branches are optimized away and
@@ -3034,7 +3035,7 @@
_upb_MiniTableField_CheckIsArray(field);
upb_Array* array = upb_Message_GetMutableArray(msg, field);
if (!array) {
- array = _upb_Array_New(arena, 4, _upb_MiniTable_ElementSizeLg2(field));
+ array = _upb_Array_New(arena, 4, _upb_MiniTableField_ElemSizeLg2(field));
// Check again due to: https://godbolt.org/z/7WfaoKG1r
_upb_MiniTableField_CheckIsArray(field);
upb_MessageValue val;