From 31b6ff6046f83dc3ce114e5ac6ca808ff92a1012 Mon Sep 17 00:00:00 2001 From: TellowKrinkle Date: Fri, 26 Nov 2021 18:32:00 -0600 Subject: [PATCH] GS: Use static_assert over assert where possible --- pcsx2/GS/GSRingHeap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pcsx2/GS/GSRingHeap.h b/pcsx2/GS/GSRingHeap.h index 9921ce267e..c36524c5ac 100644 --- a/pcsx2/GS/GSRingHeap.h +++ b/pcsx2/GS/GSRingHeap.h @@ -207,12 +207,12 @@ public: SharedPtr make_shared(Args&&... args) { using Header = typename SharedPtr::AllocationHeader; - size_t alloc_size = sizeof(T) + sizeof(Header); + constexpr size_t alloc_size = sizeof(T) + sizeof(Header); static_assert(alignof(Header) <= MIN_ALIGN, "Header alignment too high"); + static_assert(alloc_size <= UINT32_MAX, "Allocation overflow"); void* ptr = alloc_internal(sizeof(T), getAlignMask(alignof(T)), sizeof(Header)); Header* header = static_cast(ptr); - assert(alloc_size <= UINT32_MAX && "Allocation overflow"); header->size = static_cast(alloc_size); header->refcnt.store(1, std::memory_order_relaxed);