Skip to content

Commit 9a1b616

Browse files
author
Raghuveer Devulapalli
authored
Merge pull request #157 from ron-at-swgy/main
Add flags to support OpenBSD
2 parents 33a4a1d + 3bb9296 commit 9a1b616

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

lib/x86simdsort.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ static int check_cpu_feature_support(std::string_view cpufeature)
1010
const char *disable_avx512 = std::getenv("XSS_DISABLE_AVX512");
1111

1212
if ((cpufeature == "avx512_spr") && (!disable_avx512))
13-
#if defined(__FLT16_MAX__) && !defined(__INTEL_LLVM_COMPILER)
13+
#if defined(__FLT16_MAX__) && !defined(__INTEL_LLVM_COMPILER) \
14+
&& __clang_major__ >= 18
1415
return __builtin_cpu_supports("avx512f")
1516
&& __builtin_cpu_supports("avx512fp16")
1617
&& __builtin_cpu_supports("avx512vbmi2");

src/avx2-64bit-qsort.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,10 @@ struct avx2_vector<uint64_t> {
406406
};
407407

408408
/*
409-
* workaround on 64-bit macOS which defines size_t as unsigned long and defines
410-
* uint64_t as unsigned long long, both of which are 8 bytes
409+
* workaround on 64-bit macOS and OpenBSD which both define size_t as unsigned
410+
* long and define uint64_t as unsigned long long, both of which are 8 bytes
411411
*/
412-
#if defined(__APPLE__) && defined(__x86_64__)
412+
#if (defined(__APPLE__) || defined(__OpenBSD__)) && defined(__x86_64__)
413413
static_assert(sizeof(size_t) == sizeof(uint64_t),
414414
"Size of size_t and uint64_t are not the same");
415415
template <>

src/avx512-64bit-common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -960,10 +960,10 @@ struct zmm_vector<uint64_t> {
960960
};
961961

962962
/*
963-
* workaround on 64-bit macOS which defines size_t as unsigned long and defines
964-
* uint64_t as unsigned long long, both of which are 8 bytes
963+
* workaround on 64-bit macOS and OpenBSD which both define size_t as unsigned
964+
* long and define uint64_t as unsigned long long, both of which are 8 bytes
965965
*/
966-
#if defined(__APPLE__) && defined(__x86_64__)
966+
#if (defined(__APPLE__) || defined(__OpenBSD__)) && defined(__x86_64__)
967967
static_assert(sizeof(size_t) == sizeof(uint64_t),
968968
"Size of size_t and uint64_t are not the same");
969969
template <>

0 commit comments

Comments
 (0)