From 69f0ad0d68613841a79f46d44f796333629612cd Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Fri, 31 Aug 2018 16:47:30 +0300 Subject: [PATCH] Remove ALIGN_32 macro It's never used in expressions like SIZE_32(T) * n, so it doesn't help to fix any warning issued due to truncation. --- Utilities/types.h | 3 --- rpcs3/Emu/Cell/PPUModule.h | 4 ++-- rpcs3/Emu/Memory/vm_ptr.h | 4 ++-- rpcs3/Emu/Memory/vm_var.h | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Utilities/types.h b/Utilities/types.h index 436b1d2ff1..4568ea0951 100644 --- a/Utilities/types.h +++ b/Utilities/types.h @@ -43,9 +43,6 @@ // Return 32 bit sizeof() to avoid widening/narrowing conversions with size_t #define SIZE_32(...) static_cast(sizeof(__VA_ARGS__)) -// Return 32 bit alignof() to avoid widening/narrowing conversions with size_t -#define ALIGN_32(...) static_cast(alignof(__VA_ARGS__)) - // Variant pattern matching helper #define MATCH(arg, ...) constexpr(std::is_same_v, __VA_ARGS__>) diff --git a/rpcs3/Emu/Cell/PPUModule.h b/rpcs3/Emu/Cell/PPUModule.h index b64dada643..0fe5709d71 100644 --- a/rpcs3/Emu/Cell/PPUModule.h +++ b/rpcs3/Emu/Cell/PPUModule.h @@ -152,8 +152,8 @@ public: info.name = name; info.var = reinterpret_cast*>(Var); info.init = [] {}; - info.size = SIZE_32(typename T::type); - info.align = ALIGN_32(typename T::type); + info.size = sizeof(typename T::type); + info.align = alignof(typename T::type); info.type = typeid(T).name(); info.flags = 0; info.addr = 0; diff --git a/rpcs3/Emu/Memory/vm_ptr.h b/rpcs3/Emu/Memory/vm_ptr.h index 5e24f59846..976238e1b6 100644 --- a/rpcs3/Emu/Memory/vm_ptr.h +++ b/rpcs3/Emu/Memory/vm_ptr.h @@ -121,7 +121,7 @@ namespace vm // Test address alignment using alignof(T) bool aligned() const { - return aligned(ALIGN_32(T)); + return aligned(alignof(T)); } // Get type size @@ -133,7 +133,7 @@ namespace vm // Get type alignment static constexpr u32 align() { - return ALIGN_32(T); + return alignof(T); } // Test address for arbitrary alignment: (addr & (align - 1)) != 0 diff --git a/rpcs3/Emu/Memory/vm_var.h b/rpcs3/Emu/Memory/vm_var.h index c65cf3208a..4822ea75c6 100644 --- a/rpcs3/Emu/Memory/vm_var.h +++ b/rpcs3/Emu/Memory/vm_var.h @@ -40,7 +40,7 @@ namespace vm public: _var_base() - : pointer(A::alloc(SIZE_32(T), ALIGN_32(T))) + : pointer(A::alloc(SIZE_32(T), alignof(T))) { } @@ -72,7 +72,7 @@ namespace vm public: _var_base(u32 count) - : pointer(A::alloc(SIZE_32(T) * count, ALIGN_32(T))) + : pointer(A::alloc(SIZE_32(T) * count, alignof(T))) , m_size(SIZE_32(T) * count) { }