Skip to content

Commit 4772044

Browse files
committed
(Utils) Minor changes.
1 parent 0b8c25d commit 4772044

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

inc/Utils/Math/AABB.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace SR_MATH_NS {
2727
SR_NODISCARD bool IsValid() const noexcept;
2828
SR_NODISCARD bool IsEmpty() const noexcept;
2929
SR_NODISCARD FVector3 GetCenter() const noexcept;
30+
SR_NODISCARD FVector3 GetPosition() const noexcept;
3031
SR_NODISCARD FVector3 GetSize() const noexcept;
3132
SR_NODISCARD FVector3 GetExtends() const noexcept;
3233

src/Utils/Math/AABB.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ namespace SR_MATH_NS {
3636
return max - min;
3737
}
3838

39+
FVector3 AABB::GetPosition() const noexcept {
40+
return min;
41+
}
42+
3943
AABB AABB::UnitCube(const float_t size) noexcept {
4044
return AABB(FVector3(-size), FVector3(size));
4145
}

src/Utils/Memory/Allocator.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,18 @@ void* SRMalloc(SR_UTILS_NS::SizeType size) {
1010
if (g_TracyAllocatorInitialized) {
1111
SR_TRACY_ZONE;
1212
SR_TRACY_ZONE_COLOR(0xFF00FF00);
13-
void* pMemory = std::malloc(size);
14-
SR_TRACY_ALLOC(pMemory, size);
15-
return pMemory;
13+
void* pAllocation = std::malloc(size);
14+
if (!pAllocation) {
15+
SRHalt("SRMalloc() : failed to allocate memory! Size: {}Mb", size / (1024 * 1024));
16+
}
17+
SR_TRACY_ALLOC(pAllocation, size);
18+
return pAllocation;
1619
}
17-
return std::malloc(size);
20+
void* pAllocation = std::malloc(size);
21+
if (!pAllocation) {
22+
SRHalt("SRMalloc() : failed to allocate memory! Size: {}Mb", size / (1024 * 1024));
23+
}
24+
return pAllocation;
1825
}
1926

2027
void* SRReAlloc(void* pMemory, SR_UTILS_NS::SizeType size) {

0 commit comments

Comments
 (0)