UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IoOffsetLength.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6#include "HAL/UnrealMemory.h"
7
12{
13 FIoOffsetAndLength() = default;
14
16 {
19 }
20
21 inline uint64 GetOffset() const
22 {
23 return OffsetAndLength[4]
24 | (uint64(OffsetAndLength[3]) << 8)
25 | (uint64(OffsetAndLength[2]) << 16)
26 | (uint64(OffsetAndLength[1]) << 24)
27 | (uint64(OffsetAndLength[0]) << 32)
28 ;
29 }
30
31 inline uint64 GetLength() const
32 {
33 return OffsetAndLength[9]
34 | (uint64(OffsetAndLength[8]) << 8)
35 | (uint64(OffsetAndLength[7]) << 16)
36 | (uint64(OffsetAndLength[6]) << 24)
37 | (uint64(OffsetAndLength[5]) << 32)
38 ;
39 }
40
41 inline void SetOffset(uint64 Offset)
42 {
43 OffsetAndLength[0] = uint8(Offset >> 32);
44 OffsetAndLength[1] = uint8(Offset >> 24);
45 OffsetAndLength[2] = uint8(Offset >> 16);
46 OffsetAndLength[3] = uint8(Offset >> 8);
47 OffsetAndLength[4] = uint8(Offset >> 0);
48 }
49
50 inline void SetLength(uint64 Length)
51 {
52 OffsetAndLength[5] = uint8(Length >> 32);
53 OffsetAndLength[6] = uint8(Length >> 24);
54 OffsetAndLength[7] = uint8(Length >> 16);
55 OffsetAndLength[8] = uint8(Length >> 8);
56 OffsetAndLength[9] = uint8(Length >> 0);
57 }
58
60 inline bool IsValid() const
61 {
62 return !FMemory::MemIsZero(OffsetAndLength, 10);
63 }
64
65private:
66 // We use 5 bytes for offset and size, this is enough to represent
67 // an offset and size of 1PB
68 uint8 OffsetAndLength[5 + 5];
69};
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
uint32 Offset
Definition VulkanMemory.cpp:4033
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition IoOffsetLength.h:12
void SetOffset(uint64 Offset)
Definition IoOffsetLength.h:41
uint64 GetOffset() const
Definition IoOffsetLength.h:21
FIoOffsetAndLength()=default
void SetLength(uint64 Length)
Definition IoOffsetLength.h:50
bool IsValid() const
Definition IoOffsetLength.h:60
uint64 GetLength() const
Definition IoOffsetLength.h:31
FIoOffsetAndLength(const uint64 Offset, const uint64 Length)
Definition IoOffsetLength.h:15
static bool MemIsZero(const void *Ptr, SIZE_T Count)
Definition UnrealMemory.h:137