Rename SDL_Swap(16|32|64)(LE|BE) to SDL_Swap(LE|BE)(16|32|64)

This commit is contained in:
Anonymous Maarten
2024-06-12 01:08:19 +02:00
committed by Anonymous Maarten
parent ef6123886e
commit 32907a9606
18 changed files with 172 additions and 116 deletions

View File

@@ -326,7 +326,7 @@ SDL_FORCE_INLINE float SDL_SwapFloat(float x)
* Byte-swap an unsigned 16-bit number.
*
* This will always byte-swap the value, whether it's currently in the native
* byteorder of the system or not. You should use SDL_SwapLE16 or SDL_SwapBE16
* byteorder of the system or not. You should use SDL_Swap16LE or SDL_Swap16BE
* instead, in most cases.
*
* Note that this is a forced-inline function in a header, and not a public
@@ -347,7 +347,7 @@ SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { return x_but_byteswapped; }
* Byte-swap an unsigned 32-bit number.
*
* This will always byte-swap the value, whether it's currently in the native
* byteorder of the system or not. You should use SDL_SwapLE32 or SDL_SwapBE32
* byteorder of the system or not. You should use SDL_Swap32LE or SDL_Swap32BE
* instead, in most cases.
*
* Note that this is a forced-inline function in a header, and not a public
@@ -368,7 +368,7 @@ SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { return x_but_byteswapped; }
* Byte-swap an unsigned 64-bit number.
*
* This will always byte-swap the value, whether it's currently in the native
* byteorder of the system or not. You should use SDL_SwapLE64 or SDL_SwapBE64
* byteorder of the system or not. You should use SDL_Swap64LE or SDL_Swap64BE
* instead, in most cases.
*
* Note that this is a forced-inline function in a header, and not a public
@@ -397,7 +397,7 @@ SDL_FORCE_INLINE Uint32 SDL_Swap64(Uint64 x) { return x_but_byteswapped; }
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_SwapLE16(x) SwapOnlyIfNecessary(x)
#define SDL_Swap16LE(x) SwapOnlyIfNecessary(x)
/**
* Swap a 32-bit value from littleendian to native byte order.
@@ -411,7 +411,7 @@ SDL_FORCE_INLINE Uint32 SDL_Swap64(Uint64 x) { return x_but_byteswapped; }
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_SwapLE32(x) SwapOnlyIfNecessary(x)
#define SDL_Swap32LE(x) SwapOnlyIfNecessary(x)
/**
* Swap a 64-bit value from littleendian to native byte order.
@@ -425,7 +425,7 @@ SDL_FORCE_INLINE Uint32 SDL_Swap64(Uint64 x) { return x_but_byteswapped; }
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_SwapLE64(x) SwapOnlyIfNecessary(x)
#define SDL_Swap64LE(x) SwapOnlyIfNecessary(x)
/**
* Swap a floating point value from littleendian to native byte order.
@@ -453,7 +453,7 @@ SDL_FORCE_INLINE Uint32 SDL_Swap64(Uint64 x) { return x_but_byteswapped; }
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_SwapBE16(x) SwapOnlyIfNecessary(x)
#define SDL_Swap16BE(x) SwapOnlyIfNecessary(x)
/**
* Swap a 32-bit value from bigendian to native byte order.
@@ -467,7 +467,7 @@ SDL_FORCE_INLINE Uint32 SDL_Swap64(Uint64 x) { return x_but_byteswapped; }
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_SwapBE32(x) SwapOnlyIfNecessary(x)
#define SDL_Swap32BE(x) SwapOnlyIfNecessary(x)
/**
* Swap a 64-bit value from bigendian to native byte order.
@@ -481,7 +481,7 @@ SDL_FORCE_INLINE Uint32 SDL_Swap64(Uint64 x) { return x_but_byteswapped; }
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_SwapBE64(x) SwapOnlyIfNecessary(x)
#define SDL_Swap64BE(x) SwapOnlyIfNecessary(x)
/**
* Swap a floating point value from bigendian to native byte order.
@@ -498,22 +498,22 @@ SDL_FORCE_INLINE Uint32 SDL_Swap64(Uint64 x) { return x_but_byteswapped; }
#define SDL_SwapFloatBE(x) SwapOnlyIfNecessary(x)
#elif SDL_BYTEORDER == SDL_LIL_ENDIAN
#define SDL_SwapLE16(x) (x)
#define SDL_SwapLE32(x) (x)
#define SDL_SwapLE64(x) (x)
#define SDL_Swap16LE(x) (x)
#define SDL_Swap32LE(x) (x)
#define SDL_Swap64LE(x) (x)
#define SDL_SwapFloatLE(x) (x)
#define SDL_SwapBE16(x) SDL_Swap16(x)
#define SDL_SwapBE32(x) SDL_Swap32(x)
#define SDL_SwapBE64(x) SDL_Swap64(x)
#define SDL_Swap16BE(x) SDL_Swap16(x)
#define SDL_Swap32BE(x) SDL_Swap32(x)
#define SDL_Swap64BE(x) SDL_Swap64(x)
#define SDL_SwapFloatBE(x) SDL_SwapFloat(x)
#else
#define SDL_SwapLE16(x) SDL_Swap16(x)
#define SDL_SwapLE32(x) SDL_Swap32(x)
#define SDL_SwapLE64(x) SDL_Swap64(x)
#define SDL_Swap16LE(x) SDL_Swap16(x)
#define SDL_Swap32LE(x) SDL_Swap32(x)
#define SDL_Swap64LE(x) SDL_Swap64(x)
#define SDL_SwapFloatLE(x) SDL_SwapFloat(x)
#define SDL_SwapBE16(x) (x)
#define SDL_SwapBE32(x) (x)
#define SDL_SwapBE64(x) (x)
#define SDL_Swap16BE(x) (x)
#define SDL_Swap32BE(x) (x)
#define SDL_Swap64BE(x) (x)
#define SDL_SwapFloatBE(x) (x)
#endif

View File

@@ -74,6 +74,14 @@
/* ##SDL_cpuinfo.h */
#define SDL_SIMDGetAlignment SDL_GetSIMDAlignment
/* ##SDL_endian.h */
#define SDL_SwapBE16 SDL_Swap16BE
#define SDL_SwapBE32 SDL_Swap32BE
#define SDL_SwapBE64 SDL_Swap64BE
#define SDL_SwapLE16 SDL_Swap16LE
#define SDL_SwapLE32 SDL_Swap32LE
#define SDL_SwapLE64 SDL_Swap64LE
/* ##SDL_events.h */
#define SDL_APP_DIDENTERBACKGROUND SDL_EVENT_DID_ENTER_BACKGROUND
#define SDL_APP_DIDENTERFOREGROUND SDL_EVENT_DID_ENTER_FOREGROUND
@@ -614,6 +622,14 @@
/* ##SDL_cpuinfo.h */
#define SDL_SIMDGetAlignment SDL_SIMDGetAlignment_renamed_SDL_GetSIMDAlignment
/* ##SDL_endian.h */
#define SDL_SwapBE16 SDL_SwapBE16_renamed_SDL_Swap16BE
#define SDL_SwapBE32 SDL_SwapBE32_renamed_SDL_Swap32BE
#define SDL_SwapBE64 SDL_SwapBE64_renamed_SDL_Swap64BE
#define SDL_SwapLE16 SDL_SwapLE16_renamed_SDL_Swap16LE
#define SDL_SwapLE32 SDL_SwapLE32_renamed_SDL_Swap32LE
#define SDL_SwapLE64 SDL_SwapLE64_renamed_SDL_Swap64LE
/* ##SDL_events.h */
#define SDL_APP_DIDENTERBACKGROUND SDL_APP_DIDENTERBACKGROUND_renamed_SDL_EVENT_DID_ENTER_BACKGROUND
#define SDL_APP_DIDENTERFOREGROUND SDL_APP_DIDENTERFOREGROUND_renamed_SDL_EVENT_DID_ENTER_FOREGROUND