Backed out a functional refactoring.

pull/13171/head
Joshua Haberman 3 years ago
parent 532dc1f0f0
commit 44363393f3
  1. 6
      upb/encode.c
  2. 13
      upb/msg_internal.h

@ -448,17 +448,11 @@ static bool encode_shouldencode(upb_encstate* e, const upb_Message* msg,
memcpy(&ch, mem, 1); memcpy(&ch, mem, 1);
return ch != 0; return ch != 0;
} }
#if UINTPTR_MAX == 0xffffffff
case upb_FieldRep_Pointer:
#endif
case kUpb_FieldRep_4Byte: { case kUpb_FieldRep_4Byte: {
uint32_t u32; uint32_t u32;
memcpy(&u32, mem, 4); memcpy(&u32, mem, 4);
return u32 != 0; return u32 != 0;
} }
#if UINTPTR_MAX != 0xffffffff
case kUpb_FieldRep_Pointer:
#endif
case kUpb_FieldRep_8Byte: { case kUpb_FieldRep_8Byte: {
uint64_t u64; uint64_t u64;
memcpy(&u64, mem, 8); memcpy(&u64, mem, 8);

@ -97,10 +97,17 @@ typedef enum {
typedef enum { typedef enum {
kUpb_FieldRep_1Byte = 0, kUpb_FieldRep_1Byte = 0,
kUpb_FieldRep_4Byte = 1, kUpb_FieldRep_4Byte = 1,
kUpb_FieldRep_Pointer = 2, kUpb_FieldRep_8Byte = 2,
kUpb_FieldRep_StringView = 3, kUpb_FieldRep_StringView = 3,
kUpb_FieldRep_8Byte = 4,
kUpb_FieldRep_Shift = 5, // Bit offset of the rep in upb_MiniTable_Field.mode #if UINTPTR_MAX == 0xffffffff
kUpb_FieldRep_Pointer = kUpb_FieldRep_4Byte,
#else
kUpb_FieldRep_Pointer = kUpb_FieldRep_8Byte,
#endif
kUpb_FieldRep_Shift =
6, /* Bit offset of the rep in upb_MiniTable_Field.mode */
} upb_FieldRep; } upb_FieldRep;
UPB_INLINE upb_FieldMode upb_FieldMode_Get(const upb_MiniTable_Field* field) { UPB_INLINE upb_FieldMode upb_FieldMode_Get(const upb_MiniTable_Field* field) {

Loading…
Cancel
Save