From e3302d9b96dc701b26c4850e8aac95b003fa58cf Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Jul 2010 21:36:09 -0700 Subject: [PATCH] Added SDL_FOURCC() --- include/SDL_pixels.h | 3 +-- include/SDL_stdinc.h | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/SDL_pixels.h b/include/SDL_pixels.h index 6934105aa..6024dcd0b 100644 --- a/include/SDL_pixels.h +++ b/include/SDL_pixels.h @@ -112,8 +112,7 @@ enum SDL_PACKEDLAYOUT_1010102 }; -#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) \ - ((A) | ((B) << 8) | ((C) << 16) | ((D) << 24)) +#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D) #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \ ((1 << 31) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \ diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h index c7e7edd57..ba1e5b5b2 100644 --- a/include/SDL_stdinc.h +++ b/include/SDL_stdinc.h @@ -101,6 +101,13 @@ #endif /*@}*//*Cast operators*/ +/* Define a four character code as a Uint32 */ +#define SDL_FOURCC(A, B, C, D) \ + ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24)) + /** * \name Basic data types */