From 6c80778fd3d1fc02dcff00ecf2fde3e2d271dbb5 Mon Sep 17 00:00:00 2001 From: choiahrok Date: Fri, 17 Apr 2026 02:29:41 +0000 Subject: [PATCH 1/2] fix: enhance MinGW and MSVC compatibility for aligned memory allocation --- src/CKKSTypes.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CKKSTypes.cpp b/src/CKKSTypes.cpp index b5d0763..ba019ad 100644 --- a/src/CKKSTypes.cpp +++ b/src/CKKSTypes.cpp @@ -17,7 +17,7 @@ #include "CKKSTypes.hpp" #include -#if defined(__MINGW32__) +#if defined(__MINGW32__) || defined(_MSC_VER) #include #endif @@ -25,7 +25,7 @@ namespace deb { #if DEB_ALINAS_LEN != 0 inline void *deb_aligned_alloc(size_t alignment, size_t size) { -#if defined(__MINGW32__) +#if defined(__MINGW32__) || defined(_MSC_VER) return _aligned_malloc(size, alignment); #else return std::aligned_alloc(alignment, size); @@ -33,7 +33,7 @@ inline void *deb_aligned_alloc(size_t alignment, size_t size) { } inline void deb_aligned_free(void *ptr) { -#if defined(__MINGW32__) +#if defined(__MINGW32__) || defined(_MSC_VER) _aligned_free(ptr); #else std::free(ptr); From f80b6dc42db704a72edb8528d8e52024c3b7ce07 Mon Sep 17 00:00:00 2001 From: choiahrok Date: Fri, 17 Apr 2026 06:41:14 +0000 Subject: [PATCH 2/2] fix: use _WIN32 for Windows aligned allocation path --- src/CKKSTypes.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CKKSTypes.cpp b/src/CKKSTypes.cpp index ba019ad..d105f7a 100644 --- a/src/CKKSTypes.cpp +++ b/src/CKKSTypes.cpp @@ -17,7 +17,7 @@ #include "CKKSTypes.hpp" #include -#if defined(__MINGW32__) || defined(_MSC_VER) +#if defined(_WIN32) #include #endif @@ -25,7 +25,7 @@ namespace deb { #if DEB_ALINAS_LEN != 0 inline void *deb_aligned_alloc(size_t alignment, size_t size) { -#if defined(__MINGW32__) || defined(_MSC_VER) +#if defined(_WIN32) return _aligned_malloc(size, alignment); #else return std::aligned_alloc(alignment, size); @@ -33,7 +33,7 @@ inline void *deb_aligned_alloc(size_t alignment, size_t size) { } inline void deb_aligned_free(void *ptr) { -#if defined(__MINGW32__) || defined(_MSC_VER) +#if defined(_WIN32) _aligned_free(ptr); #else std::free(ptr);