From dcad623226d491c7c8b138fc3af95d8e1b1f4947 Mon Sep 17 00:00:00 2001 From: mama6090 Date: Tue, 18 Aug 2020 00:52:52 +0200 Subject: [PATCH 1/2] Added missing "defined" for ifs, which fixes compiler issues Example compiler error: "_MSC_VER" is not defined [-Werror=undef] --- libmorton/include/morton.h | 2 +- libmorton/include/morton_BMI.h | 2 +- libmorton/include/morton_common.h | 8 ++++---- test/libmorton_test.cpp | 6 +++--- test/timer.h | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libmorton/include/morton.h b/libmorton/include/morton.h index 0addbac..c6c0c97 100644 --- a/libmorton/include/morton.h +++ b/libmorton/include/morton.h @@ -77,7 +77,7 @@ namespace libmorton { inline void morton3D_64_decode(const uint_fast64_t morton, uint_fast32_t& x, uint_fast32_t& y, uint_fast32_t& z) { m3D_d_BITALG(morton, x, y, z); } -#elif defined(__BMI2__) || __AVX2__ +#elif defined(__BMI2__) || defined(__AVX2__) inline void morton2D_32_decode(const uint_fast32_t morton, uint_fast16_t& x, uint_fast16_t& y) { m2D_d_BMI(morton, x, y); } diff --git a/libmorton/include/morton_BMI.h b/libmorton/include/morton_BMI.h index 53133b9..6b0222f 100644 --- a/libmorton/include/morton_BMI.h +++ b/libmorton/include/morton_BMI.h @@ -1,5 +1,5 @@ #pragma once -#if defined(__BMI2__) || __AVX2__ +#if defined(__BMI2__) || defined(__AVX2__) #include #include diff --git a/libmorton/include/morton_common.h b/libmorton/include/morton_common.h index 41ce77a..41078d5 100644 --- a/libmorton/include/morton_common.h +++ b/libmorton/include/morton_common.h @@ -3,14 +3,14 @@ // Libmorton - Common helper methods needed in Morton encoding/decoding #include -#if _MSC_VER +#if defined(_MSC_VER) #include #endif namespace libmorton { template inline bool findFirstSetBitZeroIdx(const morton x, unsigned long* firstbit_location) { -#if _MSC_VER && !_WIN64 +#if defined(_MSC_VER) && !defined(_WIN64) // 32 BIT on 32 BIT if (sizeof(morton) <= 4) { return _BitScanReverse(firstbit_location, x) != 0; @@ -24,10 +24,10 @@ namespace libmorton { } return _BitScanReverse(firstbit_location, (x & 0xFFFFFFFF)) != 0; } -#elif _MSC_VER && _WIN64 +#elif defined(_MSC_VER) && defined(_WIN64) // 32 or 64 BIT on 64 BIT return _BitScanReverse64(firstbit_location, x) != 0; -#elif __GNUC__ +#elif defined(__GNUC__) if (x == 0) { return false; } diff --git a/test/libmorton_test.cpp b/test/libmorton_test.cpp index 0f1c7a8..f6414c6 100644 --- a/test/libmorton_test.cpp +++ b/test/libmorton_test.cpp @@ -93,14 +93,14 @@ void parseProgramParameters(int argc, char* argv[]) { void printHeader(){ cout << "LIBMORTON TEST SUITE" << endl; cout << "--------------------" << endl; -#if _WIN64 || __x86_64__ +#if defined(_WIN64) || defined(__x86_64__) cout << "++ 64-bit version" << endl; #else cout << "++ 32-bit version" << endl; #endif -#if _MSC_VER +#if defined(_MSC_VER) cout << "++ Compiled using MSVC " << _MSC_VER << endl; -#elif __GNUC__ +#elif defined(__GNUC__) cout << "++ Compiled using GCC" << endl; #endif cout << "++ Running tests until we've reached " << MAXRUNSIZE << "^3 codes" << endl; diff --git a/test/timer.h b/test/timer.h index d2282b7..9ae5743 100644 --- a/test/timer.h +++ b/test/timer.h @@ -4,13 +4,13 @@ #pragma once -#if _MSC_VER +#if defined(_MSC_VER) #include -#elif __GNUC__ +#elif defined(__GNUC__) #include "time.h" #endif -#if _MSC_VER +#if defined(_MSC_VER) struct Timer { double pc_frequency = 0.0; double elapsed_time_milliseconds = 0.0; From 45fcc1dabf2aaf8da36cd0d5f8bfa92d2b5d5a12 Mon Sep 17 00:00:00 2001 From: Jeroen Baert <3607063+Forceflow@users.noreply.github.com> Date: Sun, 23 Aug 2020 21:57:16 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9bd1abe..9517c91 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Libmorton v0.2.4 +# Libmorton v0.2.5 [![Build Status](https://travis-ci.org/Forceflow/libmorton.svg?branch=master)](https://travis-ci.org/Forceflow/libmorton) [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://opensource.org/licenses/MIT) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/forceflow) * Libmorton is a **C++ header-only library** with methods to efficiently encode/decode 64, 32 and 16-bit Morton codes and coordinates, in 2D and 3D. *Morton order* is also known as *Z-order* or *[the Z-order curve](https://en.wikipedia.org/wiki/Z-order_curve)*.