MCPcopy Create free account
hub / github.com/PCGEx/PCGExtendedToolkit / ScopeIndices

Function ScopeIndices

Source/PCGExtendedToolkit/Private/PCGEx.cpp:66–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64 }
65
66 void ScopeIndices(const TArray<int32>& InIndices, TArray<uint64>& OutScopes)
67 {
68 TArray<int32> InIndicesCopy = InIndices;
69 InIndicesCopy.Sort();
70
71 int32 StartIndex = InIndicesCopy[0];
72 int32 LastIndex = StartIndex;
73 int32 Count = 1;
74
75 for (int i = 1; i < InIndicesCopy.Num(); i++)
76 {
77 const int32 NextIndex = InIndicesCopy[i];
78 if (NextIndex == (LastIndex + 1))
79 {
80 Count++;
81 LastIndex = NextIndex;
82 continue;
83 }
84
85 OutScopes.Emplace(H64(StartIndex, Count));
86 LastIndex = StartIndex = NextIndex;
87 Count = 0;
88 }
89
90 OutScopes.Emplace(H64(StartIndex, Count));
91 }
92}

Callers

nothing calls this directly

Calls 3

NumMethod · 0.80
H64Function · 0.50
SortMethod · 0.45

Tested by

no test coverage detected