Skip to content

Commit dec76a2

Browse files
committed
Removed MSVC requirement for AVX2 compilation (see issue #71)
1 parent 16b9786 commit dec76a2

File tree

6 files changed

+7
-10
lines changed

6 files changed

+7
-10
lines changed

include/libmorton/morton.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "morton2D.h"
1010
#include "morton3D.h"
1111

12-
#if defined(__BMI2__) || (defined(__AVX2__) && defined(_MSC_VER))
12+
#if defined(__BMI2__) || defined(__AVX2__)
1313
#include "morton_BMI.h"
1414
#elif defined(__AVX512BITALG__)
1515
#include "morton_AVX512BITALG.h"
@@ -20,7 +20,7 @@ namespace libmorton {
2020
//-----------------------------------------------------------------------------------------------
2121

2222
// ENCODING
23-
#if defined(__BMI2__) || (defined(__AVX2__) && defined(_MSC_VER))
23+
#if defined(__BMI2__) || defined(__AVX2__)
2424
inline uint_fast32_t morton2D_32_encode(const uint_fast16_t x, const uint_fast16_t y) {
2525
return m2D_e_BMI<uint_fast32_t, uint_fast16_t>(x, y);
2626
}
@@ -63,7 +63,7 @@ namespace libmorton {
6363

6464
// DECODING
6565

66-
#if defined(__BMI2__) || (defined(__AVX2__) && defined(_MSC_VER))
66+
#if defined(__BMI2__) || defined(__AVX2__)
6767
inline void morton2D_32_decode(const uint_fast32_t morton, uint_fast16_t& x, uint_fast16_t& y) {
6868
m2D_d_BMI<uint_fast32_t, uint_fast16_t>(morton, x, y);
6969
}

include/libmorton/morton_BMI.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#pragma once
2-
#if defined(__BMI2__) || (defined(__AVX2__) && defined(_MSC_VER))
2+
#if defined(__BMI2__) || defined(__AVX2__)
33
#include <immintrin.h>
44
#include <stdint.h>
55

test/libmorton_test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void registerFunctions() {
108108
f3D_32_decode.push_back(decode_3D_32_wrapper("For", &m3D_d_for<uint_fast32_t, uint_fast16_t>));
109109

110110
// Register 3D BMI intrinsics if available
111-
#if defined(__BMI2__) || (defined(__AVX2__) && defined(_MSC_VER))
111+
#if defined(__BMI2__) || defined(__AVX2__)
112112
f3D_64_encode.push_back(encode_3D_64_wrapper("BMI2 instruction set", &m3D_e_BMI<uint_fast64_t, uint_fast32_t>));
113113
f3D_32_encode.push_back(encode_3D_32_wrapper("BMI2 instruction set", &m3D_e_BMI<uint_fast32_t, uint_fast16_t>));
114114
f3D_64_decode.push_back(decode_3D_64_wrapper("BMI2 Instruction set", &m3D_d_BMI<uint_fast64_t, uint_fast32_t>));

test/libmorton_test.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// Load libraries we're going to test
2323
#include <libmorton/morton2D.h>
2424
#include <libmorton/morton3D.h>
25-
#if defined(__BMI2__) || (defined(__AVX2__) && defined(_MSC_VER))
25+
#if defined(__BMI2__) || defined(__AVX2__)
2626
#include <libmorton/morton_BMI.h>
2727
#endif
2828
#if defined(__AVX512BITALG__)

test/test2D_performance.h

-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ extern size_t CURRENT_TEST_MAX;
1010
extern unsigned int times;
1111
extern std::vector<uint_fast64_t> running_sums;
1212

13-
14-
15-
1613
// Check 2D encode function performance (linear)
1714
template <typename morton, typename coord>
1815
static double testEncode_2D_Linear_Perf(morton(*function)(coord, coord), size_t times) {

test/test3D_correctness.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ inline bool check3D_Match(const encode_f_3D_wrapper<morton, coord>& encode, deco
112112
coord x_result, y_result, z_result;
113113
morton mortonresult = encode.encode(x, y, z);
114114
decode.decode(mortonresult, x_result, y_result, z_result);
115-
if ((x != x_result) | (y != y_result) | (z != z_result)) {
115+
if ((x != x_result) || (y != y_result) || (z != z_result)) {
116116
std::cout << "\n" << "x: " << getBitString<coord>(x) << " (" << x << ")\n";
117117
std::cout << "y: " << getBitString<coord>(y) << " (" << y << ")\n";
118118
std::cout << "z: " << getBitString<coord>(z) << " (" << z << ")\n";

0 commit comments

Comments
 (0)