============================================================================
*/
-#if !defined(ENDIAN_LITTLE) && !defined(ENDIAN_BIG)
-short (*BigShort) (short l);
-short (*LittleShort) (short l);
-int (*BigLong) (int l);
-int (*LittleLong) (int l);
-float (*BigFloat) (float l);
-float (*LittleFloat) (float l);
-#endif
-
short ShortSwap (short l)
{
qbyte b1,b2;
return (b1<<8) + b2;
}
-#if !defined(ENDIAN_LITTLE) && !defined(ENDIAN_BIG)
-short ShortNoSwap (short l)
-{
- return l;
-}
-#endif
-
int LongSwap (int l)
{
qbyte b1,b2,b3,b4;
return ((int)b1<<24) + ((int)b2<<16) + ((int)b3<<8) + b4;
}
-#if !defined(ENDIAN_LITTLE) && !defined(ENDIAN_BIG)
-int LongNoSwap (int l)
-{
- return l;
-}
-#endif
-
float FloatSwap (float f)
{
union
return dat2.f;
}
-#if !defined(ENDIAN_LITTLE) && !defined(ENDIAN_BIG)
-float FloatNoSwap (float f)
-{
- return f;
-}
-#endif
-
// Extract integers from buffers
*/
void COM_Init (void)
{
-#if !defined(ENDIAN_LITTLE) && !defined(ENDIAN_BIG)
- qbyte swaptest[2] = {1,0};
-
-// set the byte swapping variables in a portable manner
- if ( *(short *)swaptest == 1)
- {
- BigShort = ShortSwap;
- LittleShort = ShortNoSwap;
- BigLong = LongSwap;
- LittleLong = LongNoSwap;
- BigFloat = FloatSwap;
- LittleFloat = FloatNoSwap;
- }
- else
- {
- BigShort = ShortNoSwap;
- LittleShort = ShortSwap;
- BigLong = LongNoSwap;
- LittleLong = LongSwap;
- BigFloat = FloatNoSwap;
- LittleFloat = FloatSwap;
- }
-#endif
-
Cvar_RegisterVariable (®istered);
Cvar_RegisterVariable (&cmdline);