SDL-1.2: SDL_endian.h: use compiler bswap builtins for Apple M1 chip:

From 28724a300bba8ce636f9213c273852847092a4a6 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Wed, 24 Nov 2021 14:56:50 +0300
Subject: [PATCH] SDL_endian.h: use compiler bswap builtins for Apple M1 chip:

Denis Popov reports that testplatform application fails swap check
otherwise - see:
https://github.com/de4me/SDL-1.2-xcode/commit/d7502784c580e1c943b96790a059601874db8ea9
---
 include/SDL_endian.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/include/SDL_endian.h b/include/SDL_endian.h
index db5343f9a..db10aea9f 100644
--- a/include/SDL_endian.h
+++ b/include/SDL_endian.h
@@ -94,6 +94,11 @@ static __inline__ Uint16 SDL_Swap16(Uint16 x)
 	__asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x));
 	return (Uint16)result;
 }
+#elif defined(__APPLE__) && defined(__aarch64__)
+static __inline__ Uint16 SDL_Swap16(Uint16 x)
+{
+	return __builtin_bswap16(x);
+}
 #elif defined(__GNUC__) && defined(__aarch64__)
 static __inline__ Uint16 SDL_Swap16(Uint16 x)
 {
@@ -141,6 +146,11 @@ static __inline__ Uint32 SDL_Swap32(Uint32 x)
 	__asm__("rlwimi %0,%2,24,0,7"   : "=&r" (result) : "0" (result), "r" (x));
 	return result;
 }
+#elif defined(__APPLE__) && defined(__aarch64__)
+static __inline__ Uint32 SDL_Swap32(Uint32 x)
+{
+	return __builtin_bswap32(x);
+}
 #elif defined(__GNUC__) && defined(__aarch64__)
 static __inline__ Uint32 SDL_Swap32(Uint32 x)
 {
@@ -180,6 +190,11 @@ static __inline__ Uint64 SDL_Swap64(Uint64 x)
 	        : "0"  (v.s.a),  "1" (v.s.b));
 	return v.u;
 }
+#elif defined(__APPLE__) && defined(__aarch64__)
+static __inline__ Uint64 SDL_Swap64(Uint64 x)
+{
+	return __builtin_bswap64(x);
+}
 #elif defined(__GNUC__) && defined(__x86_64__)
 static __inline__ Uint64 SDL_Swap64(Uint64 x)
 {