diff options
author | Brian Paul <[email protected]> | 2002-06-03 16:06:34 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2002-06-03 16:06:34 +0000 |
commit | f5a078197552bc956322e2fa292b034e4ccb9d82 (patch) | |
tree | 868c34dd27374bdb07d2e20ef4a1dd72e23d66b3 /src/mesa/main/macros.h | |
parent | 91d6f12b4ad4d5dde42ef0c86e4531a60f770dbd (diff) |
bring over Michel Daenzer's DRI changes
Diffstat (limited to 'src/mesa/main/macros.h')
-rw-r--r-- | src/mesa/main/macros.h | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index bb83b30d5d4..9444975ab1f 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -1,4 +1,3 @@ -/* $Id: macros.h,v 1.25 2002/02/13 00:53:19 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -454,6 +453,19 @@ do { \ +/* Byte swapping + */ + +#ifdef __BIG_ENDIAN +#include <byteswap.h> +#define CPU_TO_LE32( x ) bswap_32( x ) +#else +#define CPU_TO_LE32( x ) ( x ) +#endif + +#define LE32_TO_CPU( x ) CPU_TO_LE32( x ) + + /* Generic color packing macros */ @@ -480,4 +492,35 @@ do { \ (((a) & 0xe0) | (((b) & 0xe0) >> 3) | (((c) & 0xc0) >> 6)) +#ifdef __BIG_ENDIAN + +#define PACK_COLOR_8888_LE( a, b, c, d ) PACK_COLOR_8888( d, c, b, a ) + +#define PACK_COLOR_565_LE( a, b, c ) \ + (((a) & 0xf8) | (((b) & 0xe0) >> 5) | (((b) & 0x1c) << 11) | \ + (((c) & 0xf8) << 5)) + +#define PACK_COLOR_1555_LE( a, b, c, d ) \ + ((((b) & 0xf8) >> 1) | (((c) & 0xc0) >> 6) | (((c) & 0x38) << 10) | \ + (((d) & 0xf8) << 5) | ((a) ? 0x80 : 0)) + +#define PACK_COLOR_4444_LE( a, b, c, d ) PACK_COLOR_4444( c, d, a, b ) + +#define PACK_COLOR_88_LE( a, b ) PACK_COLOR_88( b, a ) + +#else /* little endian */ + +#define PACK_COLOR_8888_LE( a, b, c, d ) PACK_COLOR_8888( a, b, c, d ) + +#define PACK_COLOR_565_LE( a, b, c ) PACK_COLOR_565( a, b, c ) + +#define PACK_COLOR_1555_LE( a, b, c, d ) PACK_COLOR_1555( a, b, c, d ) + +#define PACK_COLOR_4444_LE( a, b, c, d ) PACK_COLOR_4444( a, b, c, d ) + +#define PACK_COLOR_88_LE( a, b ) PACK_COLOR_88( a, b ) + +#endif /* endianness */ + + #endif |