diff --git a/src/KOKKOS/math_special_kokkos.h b/src/KOKKOS/math_special_kokkos.h
index c177e88574a6a5fb9ddc5acdccf4b562824f2356..88008312bf19a03246e4f100c084954b06658c17 100644
--- a/src/KOKKOS/math_special_kokkos.h
+++ b/src/KOKKOS/math_special_kokkos.h
@@ -42,12 +42,11 @@ namespace MathSpecialKokkos {
   {
     x *= x;
     x *= 1.4426950408889634074; // log_2(e)
-#if defined(__BYTE_ORDER__)
-#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#if defined(__BYTE_ORDER__) &&  __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
     return (x < 1023.0) ? exp2_x86(-x) : 0.0;
-#endif
-#endif
+#else
     return (x < 1023.0) ? exp2(-x) : 0.0;
+#endif
   }
 
   // x**2, use instead of pow(x,2.0)
diff --git a/src/math_special.h b/src/math_special.h
index 059ef5d3c71dbf0d2acb0da91495875c478f97b9..e4b4998d54fb07fe4f5ad39bbe3e5e2ac4209b59 100644
--- a/src/math_special.h
+++ b/src/math_special.h
@@ -41,12 +41,11 @@ namespace MathSpecial {
   {
     x *= x;
     x *= 1.4426950408889634074; // log_2(e)
-#if defined(__BYTE_ORDER__)
-#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
     return (x < 1023.0) ? exp2_x86(-x) : 0.0;
-#endif
-#endif
+#else
     return (x < 1023.0) ? exp2(-x) : 0.0;
+#endif
   }
 
   // x**2, use instead of pow(x,2.0)