SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL3pp_endian.h
1#ifndef SDL3PP_ENDIAN_H_
2#define SDL3PP_ENDIAN_H_
3
4#include <SDL3/SDL_endian.h>
5#include "SDL3pp_stdinc.h"
6
7namespace SDL {
8
28#ifdef SDL3PP_DOC
29
47#define SDL_LIL_ENDIAN 1234
48
66#define SDL_BIG_ENDIAN 4321
67
86#define SDL_BYTEORDER SDL_LIL_ENDIAN___or_maybe___SDL_BIG_ENDIAN
87
106#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN___or_maybe___SDL_BIG_ENDIAN
107
108#endif // SDL3PP_DOC
109
129constexpr Uint16 Swap16(Uint16 x) { return SDL_Swap16(x); }
130
150constexpr Uint32 Swap32(Uint32 x) { return SDL_Swap32(x); }
151
171constexpr Uint64 Swap64(Uint64 x) { return SDL_Swap64(x); }
172
192constexpr float SwapFloat(float x) { return SDL_SwapFloat(x); }
193
208constexpr Uint16 Swap16LE(Uint16 x) { return SDL_Swap16LE(x); }
209
224constexpr Uint32 Swap32LE(Uint32 x) { return SDL_Swap32LE(x); }
225
240constexpr Uint64 Swap64LE(Uint64 x) { return SDL_Swap64LE(x); }
241
256constexpr float SwapFloatLE(float x) { return SDL_SwapFloatLE(x); }
257
272constexpr Uint16 Swap16BE(Uint16 x) { return SDL_Swap16BE(x); }
273
288constexpr Uint32 Swap32BE(Uint32 x) { return SDL_Swap32BE(x); }
289
304constexpr Uint64 Swap64BE(Uint64 x) { return SDL_Swap64BE(x); }
305
320constexpr float SwapFloatBE(float x) { return SDL_SwapFloatBE(x); }
321
323
324} // namespace SDL
325
326#endif /* SDL3PP_ENDIAN_H_ */
constexpr Uint16 Swap16(Uint16 x)
Byte-swap an unsigned 16-bit number.
Definition: SDL3pp_endian.h:129
constexpr Uint16 Swap16BE(Uint16 x)
Swap a 16-bit value from bigendian to native byte order.
Definition: SDL3pp_endian.h:272
constexpr Uint64 Swap64LE(Uint64 x)
Swap a 64-bit value from littleendian to native byte order.
Definition: SDL3pp_endian.h:240
constexpr Uint64 Swap64BE(Uint64 x)
Swap a 64-bit value from bigendian to native byte order.
Definition: SDL3pp_endian.h:304
constexpr float SwapFloatBE(float x)
Swap a floating point value from bigendian to native byte order.
Definition: SDL3pp_endian.h:320
constexpr Uint64 Swap64(Uint64 x)
Byte-swap an unsigned 64-bit number.
Definition: SDL3pp_endian.h:171
constexpr float SwapFloatLE(float x)
Swap a floating point value from littleendian to native byte order.
Definition: SDL3pp_endian.h:256
constexpr Uint32 Swap32(Uint32 x)
Byte-swap an unsigned 32-bit number.
Definition: SDL3pp_endian.h:150
constexpr Uint32 Swap32BE(Uint32 x)
Swap a 32-bit value from bigendian to native byte order.
Definition: SDL3pp_endian.h:288
constexpr float SwapFloat(float x)
Byte-swap a floating point number.
Definition: SDL3pp_endian.h:192
constexpr Uint32 Swap32LE(Uint32 x)
Swap a 32-bit value from littleendian to native byte order.
Definition: SDL3pp_endian.h:224
constexpr Uint16 Swap16LE(Uint16 x)
Swap a 16-bit value from littleendian to native byte order.
Definition: SDL3pp_endian.h:208
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition: SDL3pp_stdinc.h:341
::Uint64 Uint64
An unsigned 64-bit integer type.
Definition: SDL3pp_stdinc.h:371
::Uint16 Uint16
An unsigned 16-bit integer type.
Definition: SDL3pp_stdinc.h:315
Main include header for the SDL3pp library.