FBitWriter::SerializeIntPacked

This function is bit compatible with [FArchive::SerializeIntPacked](API\Runtime\Core\Serialization\FArchive\SerializeIntPacked).

Choose your operating system:

Windows

macOS

Linux

Override Hierarchy

FArchive::SerializeIntPacked()

FBitWriter::SerializeIntPacked()

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Serialization/BitWriter.h

Include

#include "Serialization/BitWriter.h"

Source

/Engine/Source/Runtime/Core/Private/Serialization/BitWriter.cpp

Syntax

virtual void SerializeIntPacked
(
    uint32 & Value
)

Remarks

This function is bit compatible with FArchive::SerializeIntPacked. It is more efficient as only a few bytes are written and the base version is best suited for writing many bytes. This version can be made more efficient and take less bits when we can break backward compatibility. The last byte will only need 4 bits so we're currently wasting 4 bits. Another way to pack could be to store 2 bits first in order to indicate how many bytes are needed. That would eliminate all shifting and masking to reconstruct the bytes. The downside is that values less than 2^14 will waste 1-2 bits compared to the below algorithm.