SDL_image: define MINIZ_LITTLE_ENDIAN based on SDL_BYTEORDER.

From 103ebc453e69b55c70b891a9eb2ac62db38ae21c Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Tue, 20 Jul 2021 23:02:20 +0300
Subject: [PATCH] define MINIZ_LITTLE_ENDIAN based on SDL_BYTEORDER.

---
 IMG_png.c | 6 +++++-
 miniz.h   | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/IMG_png.c b/IMG_png.c
index 7779e57..76fc7a7 100644
--- a/IMG_png.c
+++ b/IMG_png.c
@@ -620,7 +620,11 @@ static int IMG_SavePNG_RW_libpng(SDL_Surface *surface, SDL_RWops *dst, int freed
 #undef memset
 #define memset  SDL_memset
 #define strlen  SDL_strlen
-
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+#define MINIZ_LITTLE_ENDIAN 1
+#else
+#define MINIZ_LITTLE_ENDIAN 0
+#endif
 #include "miniz.h"
 
 static int IMG_SavePNG_RW_miniz(SDL_Surface *surface, SDL_RWops *dst, int freedst)
diff --git a/miniz.h b/miniz.h
index 979eb65..8b0987f 100644
--- a/miniz.h
+++ b/miniz.h
@@ -209,10 +209,12 @@
 #define MINIZ_X86_OR_X64_CPU 1
 #endif
 
+#ifndef MINIZ_LITTLE_ENDIAN /* if not defined by SDL */
 #if (__BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__) || MINIZ_X86_OR_X64_CPU
 // Set MINIZ_LITTLE_ENDIAN to 1 if the processor is little endian.
 #define MINIZ_LITTLE_ENDIAN 1
 #endif
+#endif /**/
 
 #if MINIZ_X86_OR_X64_CPU
 // Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to 1 on CPU's that permit efficient integer loads and stores from unaligned addresses.