5#include "Containers/Array.h"
7#include "HAL/UnrealMemory.h"
8#include "Misc/AssertionMacros.h"
9#include "Serialization/BitArchive.h"
13void appBitsCpy( uint8* Dest, int32 DestBit, uint8* Src, int32 SrcBit, int32 BitCount );
16
17
37 void SetData( uint8* Src, int64 CountBits );
38 void SetData( TArray<uint8>&& Src, int64 CountBits );
44#pragma warning( push )
45#pragma warning( disable : 4789
)
65 ((uint8*)Dest)[0] = 0;
66 if( Buffer[(int32)(Pos>>3)] & Shift(Pos&7) )
67 ((uint8*)Dest)[0] |= 0x01;
70 else if (LengthBits != 0)
72 ((uint8*)Dest)[((LengthBits+7)>>3) - 1] = 0;
73 appBitsCpy((uint8*)Dest, 0, Buffer.GetData(), (int32)Pos, (int32)LengthBits);
91 const int64 LocalNum =
Num;
93 for (uint32 Mask=1; (Value + Mask) < ValueMax && Mask; Mask *= 2, LocalPos++)
95 if (LocalPos >= LocalNum)
101 if (Buffer[(int32)(LocalPos >> 3)] & Shift(LocalPos & 7))
130 int64 LocalPos =
Pos;
131 const int64 LocalNum =
Num;
132 if (LocalPos >= LocalNum)
139 Bit = !!(Buffer[(int32)(LocalPos>>3)] & Shift(LocalPos&7));
153 return Buffer.GetData();
158 return Buffer.GetData();
169 return &Buffer[(int32)(Pos >> 3)];
174 return ((
Num -
Pos) + 7) >> 3;
211
212
213
214
240 return (uint8)(1<<Cnt);
void appBitsCpy(uint8 *Dest, int32 DestBit, uint8 *Src, int32 SrcBit, int32 BitCount)
#define FORCEINLINE_DEBUGGABLE
FORCEINLINE bool IsError() const
FORCEINLINE_DEBUGGABLE int64 GetPosBits() const
FORCEINLINE uint8 Shift(uint8 Cnt)
FORCEINLINE_DEBUGGABLE uint8 * GetDataPosChecked()
virtual void CountMemory(FArchive &Ar) const
void SetData(TArray< uint8 > &&Src, int64 CountBits)
void SetData(uint8 *Src, int64 CountBits)
FORCEINLINE_DEBUGGABLE int64 GetNumBytes() const
FORCEINLINE_DEBUGGABLE uint32 ReadInt(uint32 Max)
void ResetData(FBitReader &Src, int64 CountBits)
FORCEINLINE_DEBUGGABLE uint8 ReadBit()
void AppendDataFromChecked(uint8 *Src, uint32 NumBits)
FBitReader & operator=(FBitReader &&)=default
FORCEINLINE_DEBUGGABLE void SerializeInt(uint32 &OutValue, uint32 ValueMax)
void SetData(FBitReader &Src, int64 CountBits)
FORCEINLINE_DEBUGGABLE int64 GetBitsLeft() const
FORCEINLINE_DEBUGGABLE void EatByteAlign()
void SetNetVersionsFromArchive(FArchive &Source)
void AppendTo(TArray< uint8 > &Buffer)
FBitReader(uint8 *Src=nullptr, int64 CountBits=0)
FORCEINLINE_DEBUGGABLE const TArray< uint8 > & GetBuffer() const
virtual void SerializeIntPacked(uint32 &Value) override
FORCEINLINE_DEBUGGABLE int64 GetBytesLeft() const
FORCEINLINE_DEBUGGABLE void SerializeBits(void *Dest, int64 LengthBits)
FORCEINLINE_DEBUGGABLE uint8 * GetData()
FBitReader & operator=(const FBitReader &)=default
FORCEINLINE_DEBUGGABLE void Serialize(void *Dest, int64 LengthBytes)
FBitReader(FBitReader &&)=default
void SetOverflowed(int64 LengthBits)
FBitReader(const FBitReader &)=default
FORCEINLINE_DEBUGGABLE bool AtEnd()
virtual void SerializeBitsWithOffset(void *Dest, int32 DestBit, int64 LengthBits) override
FORCEINLINE_DEBUGGABLE const uint8 * GetData() const
FORCEINLINE_DEBUGGABLE int64 GetNumBits() const
void AppendDataFromChecked(FBitReader &Src)
void Copy(FBitReader &Reader, TArray< uint8 > &Buffer)
FORCEINLINE_DEBUGGABLE int64 GetPos() const
FORCEINLINE_DEBUGGABLE void Pop(FBitReader &Reader)
FBitReaderMark(FBitReader &Reader)
static FORCEINLINE void * Memzero(void *Dest, SIZE_T Count)