6#include "HAL/PlatformMath.h"
56
57
58
59
60
63 return FPlatformMath::CountLeadingZeros(uint8(~*
static_cast<
const uint8*>(InData))) - 23;
75 return uint32(int32(
FPlatformMath::FloorLog2(InValue)) / 7 + 1);
81 return uint32(FPlatformMath::Min(int32(FPlatformMath::FloorLog2_64(InValue)) / 7 + 1, 9));
97
98
99
100
101
102
106 OutByteCount = ByteCount;
108 const uint8* InBytes =
static_cast<
const uint8*>(InData);
109 uint64 Value = *InBytes++ & uint8(0xff >> ByteCount);
110 switch (ByteCount - 1)
112 case 8: Value <<= 8; Value |= *InBytes++;
113 case 7: Value <<= 8; Value |= *InBytes++;
114 case 6: Value <<= 8; Value |= *InBytes++;
115 case 5: Value <<= 8; Value |= *InBytes++;
116 case 4: Value <<= 8; Value |= *InBytes++;
117 case 3: Value <<= 8; Value |= *InBytes++;
118 case 2: Value <<= 8; Value |= *InBytes++;
119 case 1: Value <<= 8; Value |= *InBytes++;
126
127
128
129
130
131
135 return -int64(Value & 1) ^ int64(Value >> 1);
139
140
141
142
143
144
148 uint8* OutBytes =
static_cast<uint8*>(OutData) + ByteCount - 1;
149 switch (ByteCount - 1)
151 case 4: *OutBytes-- = uint8(InValue); InValue >>= 8;
152 case 3: *OutBytes-- = uint8(InValue); InValue >>= 8;
153 case 2: *OutBytes-- = uint8(InValue); InValue >>= 8;
154 case 1: *OutBytes-- = uint8(InValue); InValue >>= 8;
157 *OutBytes = uint8(0xff << (9 - ByteCount)) | uint8(InValue);
162
163
164
165
166
167
171 uint8* OutBytes =
static_cast<uint8*>(OutData) + ByteCount - 1;
172 switch (ByteCount - 1)
174 case 8: *OutBytes-- = uint8(InValue); InValue >>= 8;
175 case 7: *OutBytes-- = uint8(InValue); InValue >>= 8;
176 case 6: *OutBytes-- = uint8(InValue); InValue >>= 8;
177 case 5: *OutBytes-- = uint8(InValue); InValue >>= 8;
178 case 4: *OutBytes-- = uint8(InValue); InValue >>= 8;
179 case 3: *OutBytes-- = uint8(InValue); InValue >>= 8;
180 case 2: *OutBytes-- = uint8(InValue); InValue >>= 8;
181 case 1: *OutBytes-- = uint8(InValue); InValue >>= 8;
184 *OutBytes = uint8(0xff << (9 - ByteCount)) | uint8(InValue);
191 const uint32 Value = uint32((InValue >> 31) ^ (InValue << 1));
198 const uint64 Value = uint64((InValue >> 63) ^ (InValue << 1));
FORCEINLINE uint32 WriteVarInt(int64 InValue, void *OutData)
void SerializeVarInt(FArchive &Ar, int64 &Value)
FORCEINLINE uint32 MeasureVarUInt(const void *InData)
uint64 ReadVarUIntFromArchive(FArchive &Ar)
FORCEINLINE uint32 WriteVarUInt(uint32 InValue, void *OutData)
FORCEINLINE uint32 WriteVarUInt(uint64 InValue, void *OutData)
FORCEINLINE uint64 ReadVarUInt(const void *InData, uint32 &OutByteCount)
void SerializeVarUInt(FArchive &Ar, uint64 &Value)
void WriteVarIntToArchive(FArchive &Ar, int64 Value)
FORCEINLINE uint32 MeasureVarUInt(uint32 InValue)
int64 ReadVarIntFromArchive(FArchive &Ar)
FORCEINLINE uint32 MeasureVarInt(int32 InValue)
FORCEINLINE uint32 MeasureVarInt(const void *InData)
FORCEINLINE int64 ReadVarInt(const void *InData, uint32 &OutByteCount)
FORCEINLINE uint32 MeasureVarInt(int64 InValue)
FORCEINLINE uint32 WriteVarInt(int32 InValue, void *OutData)
FORCEINLINE uint32 MeasureVarUInt(uint64 InValue)
void WriteVarUIntToArchive(FArchive &Ar, uint64 Value)