From c0d9e6da2d10cc2759b46b1d0a96328ce87a28c1 Mon Sep 17 00:00:00 2001 From: Raghuveer Devulapalli Date: Tue, 23 Jan 2024 16:28:12 -0800 Subject: [PATCH] Add avx2_vector defintion for size_t on macOS --- src/avx2-64bit-qsort.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/avx2-64bit-qsort.hpp b/src/avx2-64bit-qsort.hpp index 764bdcf4..e5f53808 100644 --- a/src/avx2-64bit-qsort.hpp +++ b/src/avx2-64bit-qsort.hpp @@ -379,6 +379,19 @@ struct avx2_vector { return v; } }; + +/* + * workaround on 64-bit macOS which defines size_t as unsigned long and defines + * uint64_t as unsigned long long, both of which are 8 bytes + */ +#if defined(__APPLE__) && defined(__x86_64__) +static_assert(sizeof(size_t) == sizeof(uint64_t), + "Size of size_t and uint64_t are not the same"); +template <> +struct avx2_vector : public avx2_vector { +}; +#endif + template <> struct avx2_vector { using type_t = double;