From 73536960142155b023bb0403a83340c387a12300 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Tue, 3 Sep 2024 12:50:49 +0300 Subject: [PATCH] cpu: Format additions to sse2neon to match the rest of the file --- rpcs3/Emu/CPU/sse2neon.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/rpcs3/Emu/CPU/sse2neon.h b/rpcs3/Emu/CPU/sse2neon.h index 02889d2eea..dfb0b1a0e1 100644 --- a/rpcs3/Emu/CPU/sse2neon.h +++ b/rpcs3/Emu/CPU/sse2neon.h @@ -132,24 +132,26 @@ #include #endif +/* RPCS3 additions */ #if defined(_WIN32) -static inline int posix_memalign(void** memptr, size_t alignment, size_t size) { +static inline int posix_memalign(void** memptr, size_t alignment, size_t size) +{ // Check for valid alignment (must be a power of two and multiple of sizeof(void*)) - if (alignment == 0 || (alignment & (alignment - 1)) != 0 || alignment % sizeof(void*) != 0) { + if (alignment == 0 || (alignment & (alignment - 1)) != 0 || alignment % sizeof(void*) != 0) return EINVAL; - } // Allocate memory using _aligned_malloc void* ptr = _aligned_malloc(size, alignment); - if (ptr == NULL) { + if (!ptr) + // NOTE: _aligned_malloc sets errno, ideally we should use that to generate the return code return ENOMEM; - } - // Set the output pointer + // Success *memptr = ptr; - return 0; // Success + return 0; } #endif +/* End RPCS3 additions */ /* "__has_builtin" can be used to query support for built-in functions * provided by gcc/clang and other compilers that support it.