From 8cc6b5ee3ac27355ae95c4ce0d60d4e70ad9bbd6 Mon Sep 17 00:00:00 2001
From: Mamoru TASAKA <mtasaka@fedoraproject.org>
Date: Wed, 1 Dec 2021 20:23:31 +0900
Subject: [PATCH] grib_api_internal.h: reverse definition of FAST_BIG_ENDIAN

In grib_api_internal.h, currently on big endian system, FAST_BIG_ENDIAN is defined
if GRIB_MEM_ALIGN is *not* defined.
On the other hand, for example in src/grib_bits.c, when FAST_BIG_ENDIAN is defined
"grib_bits_fast_big_endian.c" is included, otherwise "grib_bits_any_endian.c" is
included.

As "grib_bits_any_endian.c" is used also in x86_64 system, it is reasonable to think that
the original intention is that "grib_bits_fast_big_endian.c" needs some alignment
condition, and uses such condition for optimization, otherwise "grib_bits_any_endian.c"
should be used, so it is natural to think that the condition on grib_api_internal.h
is opposite.
---
 src/grib_api_internal.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/grib_api_internal.h b/src/grib_api_internal.h
index 3b8fae3c..0c8fcf17 100644
--- a/src/grib_api_internal.h
+++ b/src/grib_api_internal.h
@@ -40,9 +40,9 @@ extern "C" {
 
 #if IS_BIG_ENDIAN
 #if GRIB_MEM_ALIGN
-#define FAST_BIG_ENDIAN 0
-#else
 #define FAST_BIG_ENDIAN 1
+#else
+#define FAST_BIG_ENDIAN 0
 #endif
 #endif
 
-- 
2.33.1

