32 #if defined( MACOS_X )
34 #include <sys/types.h>
59 assert(
sizeof(
bool ) == 1 );
131 static dword colorMask[2] = { 255, 0 };
138 ID_INLINE
static byte ColorFloatToByte(
float c ) {
148 dword dw, dx, dy, dz;
150 dx = ColorFloatToByte( color.
x );
151 dy = ColorFloatToByte( color.
y );
152 dz = ColorFloatToByte( color.
z );
153 dw = ColorFloatToByte( color.
w );
155 #if defined(_WIN32) || defined(__linux__) || (defined(MACOS_X) && defined(__i386__))
156 return ( dx << 0 ) | ( dy << 8 ) | ( dz << 16 ) | ( dw << 24 );
157 #elif (defined(MACOS_X) && defined(__ppc__))
158 return ( dx << 24 ) | ( dy << 16 ) | ( dz << 8 ) | ( dw << 0 );
160 #error OS define is required!
170 #if defined(_WIN32) || defined(__linux__) || (defined(MACOS_X) && defined(__i386__))
171 unpackedColor.
Set( ( ( color >> 0 ) & 255 ) * ( 1.0f / 255.0f ),
172 ( ( color >> 8 ) & 255 ) * ( 1.0f / 255.0f ),
173 ( ( color >> 16 ) & 255 ) * ( 1.0f / 255.0f ),
174 ( ( color >> 24 ) & 255 ) * ( 1.0f / 255.0f ) );
175 #elif (defined(MACOS_X) && defined(__ppc__))
176 unpackedColor.
Set( ( ( color >> 24 ) & 255 ) * ( 1.0f / 255.0f ),
177 ( ( color >> 16 ) & 255 ) * ( 1.0f / 255.0f ),
178 ( ( color >> 8 ) & 255 ) * ( 1.0f / 255.0f ),
179 ( ( color >> 0 ) & 255 ) * ( 1.0f / 255.0f ) );
181 #error OS define is required!
193 dx = ColorFloatToByte( color.
x );
194 dy = ColorFloatToByte( color.
y );
195 dz = ColorFloatToByte( color.
z );
197 #if defined(_WIN32) || defined(__linux__) || (defined(MACOS_X) && defined(__i386__))
198 return ( dx << 0 ) | ( dy << 8 ) | ( dz << 16 );
199 #elif (defined(MACOS_X) && defined(__ppc__))
200 return ( dy << 16 ) | ( dz << 8 ) | ( dx << 0 );
202 #error OS define is required!
212 #if defined(_WIN32) || defined(__linux__) || (defined(MACOS_X) && defined(__i386__))
213 unpackedColor.
Set( ( ( color >> 0 ) & 255 ) * ( 1.0f / 255.0f ),
214 ( ( color >> 8 ) & 255 ) * ( 1.0f / 255.0f ),
215 ( ( color >> 16 ) & 255 ) * ( 1.0f / 255.0f ) );
216 #elif (defined(MACOS_X) && defined(__ppc__))
217 unpackedColor.
Set( ( ( color >> 16 ) & 255 ) * ( 1.0f / 255.0f ),
218 ( ( color >> 8 ) & 255 ) * ( 1.0f / 255.0f ),
219 ( ( color >> 0 ) & 255 ) * ( 1.0f / 255.0f ) );
221 #error OS define is required!
234 va_start( argptr, fmt );
250 va_start( argptr, fmt );
266 static short (*_BigShort)(
short l );
267 static short (*_LittleShort)(
short l );
268 static int (*_BigLong)(
int l );
269 static int (*_LittleLong)(
int l );
270 static float (*_BigFloat)(
float l );
271 static float (*_LittleFloat)(
float l );
272 static void (*_BigRevBytes)(
void *bp,
int elsize,
int elcount );
273 static void (*_LittleRevBytes)(
void *bp,
int elsize,
int elcount );
274 static void (*_LittleBitField)(
void *bp,
int elsize );
275 static void (*_SixtetsForInt)(
byte *out,
int src );
276 static int (*_IntForSixtets)(
byte *
in );
284 void BigRevBytes(
void *bp,
int elsize,
int elcount ) { _BigRevBytes( bp, elsize, elcount ); }
285 void LittleRevBytes(
void *bp,
int elsize,
int elcount ){ _LittleRevBytes( bp, elsize, elcount ); }
327 return ((
int)b1<<24) + ((
int)b2<<16) + ((
int)b3<<8) + b4;
352 dat2.b[0] = dat1.b[3];
353 dat2.b[1] = dat1.b[2];
354 dat2.b[2] = dat1.b[1];
355 dat2.b[3] = dat1.b[0];
383 register unsigned char *
p, *
q;
385 p = (
unsigned char * ) bp;
389 while ( elcount-- ) {
399 while ( elcount-- ) {
427 unsigned char *
p,
t,
v;
431 p = (
unsigned char *) bp;
435 for (i = 7;
i; i--) {
469 out[0] = ( b[0] & 0xfc ) >> 2;
470 out[1] = ( ( b[0] & 0x3 ) << 4 ) + ( ( b[1] & 0xf0 ) >> 4 );
471 out[2] = ( ( b[1] & 0xf ) << 2 ) + ( ( b[2] & 0xc0 ) >> 6 );
472 out[3] = b[2] & 0x3f;
482 for(
int i = 0 ;
i < 4 ;
i++ ) {
497 b[0] |= ( in[1] & 0x30 ) >> 4;
498 b[1] |= ( in[1] & 0xf ) << 4;
499 b[1] |= ( in[2] & 0x3c ) >> 2;
500 b[2] |= ( in[2] & 0x3 ) << 6;
526 byte swaptest[2] = {1,0};
529 if ( *(
short *)swaptest == 1) {
564 byte swaptest[2] = {1,0};
565 return *(
short *)swaptest != 1;
576 void AssertFailed(
const char *file,
int line,
const char *expression ) {
577 idLib::sys->
DebugPrintf(
"\n\nASSERTION FAILED!\n%s(%d): '%s'\n", file, line, expression );
580 #elif defined( __linux__ )
581 __asm__ __volatile__ (
"int $0x03");
582 #elif defined( MACOS_X )
583 kill( getpid(), SIGINT );
GLdouble GLdouble GLdouble GLdouble q
bool Swap_IsBigEndian(void)
assert(prefInfo.fullscreenBtn)
void AssertFailed(const char *file, int line, const char *expression)
static void Warning(const char *fmt,...)
static void ShutDown(void)
void UnpackColor(const dword color, idVec4 &unpackedColor)
void Set(const float x, const float y, const float z)
short ShortNoSwap(short l)
void RevBitFieldNoSwap(void *bp, int elsize)
virtual void DebugPrintf(const char *fmt,...) id_attribute((format(printf
dword PackColor(const idVec4 &color)
void LittleBitField(void *bp, int elsize)
void SixtetsForIntLittle(byte *out, int src)
int IntForSixtetsLittle(byte *in)
static void Shutdown(void)
#define FLOATSIGNBITSET(f)
static class idFileSystem * fileSystem
float FloatNoSwap(float f)
void RevBytesSwap(void *bp, int elsize, int elcount)
static void InitMemory(void)
void LittleRevBytes(void *bp, int elsize, int elcount)
void RevBitFieldSwap(void *bp, int elsize)
short LittleShort(short l)
static void ShutdownMemory(void)
static int static int vsnPrintf(char *dest, int size, const char *fmt, va_list argptr)
int IntForSixtets(byte *in)
void BigRevBytes(void *bp, int elsize, int elcount)
static class idCVarSystem * cvarSystem
static void Error(const char *fmt,...)
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
float LittleFloat(float l)
void RevBytesNoSwap(void *bp, int elsize, int elcount)
void SixtetsForIntBig(byte *out, int src)
static void Shutdown(void)
int IntForSixtetsBig(byte *in)
void SixtetsForInt(byte *out, int src)
virtual void Error(const char *fmt,...) id_attribute((format(printf
virtual void virtual void Warning(const char *fmt,...) id_attribute((format(printf
void Set(const float x, const float y, const float z, const float w)
static class idCommon * common