Stop pretending we support big endian

This commit is contained in:
cypress 2023-07-22 12:06:30 -04:00
parent fcc75883c2
commit 5b95417db8
2 changed files with 9 additions and 42 deletions

View file

@ -462,11 +462,8 @@ float Q_atof (char *str)
qboolean bigendien; qboolean bigendien;
short (*BigShort) (short l); short (*BigShort) (short l);
short (*LittleShort) (short l);
int (*BigLong) (int l); int (*BigLong) (int l);
int (*LittleLong) (int l);
float (*BigFloat) (float l); float (*BigFloat) (float l);
float (*LittleFloat) (float l);
short ShortSwap (short l) short ShortSwap (short l)
{ {
@ -478,11 +475,6 @@ short ShortSwap (short l)
return (b1<<8) + b2; return (b1<<8) + b2;
} }
short ShortNoSwap (short l)
{
return l;
}
int LongSwap (int l) int LongSwap (int l)
{ {
byte b1,b2,b3,b4; byte b1,b2,b3,b4;
@ -495,11 +487,6 @@ int LongSwap (int l)
return ((int)b1<<24) + ((int)b2<<16) + ((int)b3<<8) + b4; return ((int)b1<<24) + ((int)b2<<16) + ((int)b3<<8) + b4;
} }
int LongNoSwap (int l)
{
return l;
}
float FloatSwap (float f) float FloatSwap (float f)
{ {
union union
@ -517,11 +504,6 @@ float FloatSwap (float f)
return dat2.f; return dat2.f;
} }
float FloatNoSwap (float f)
{
return f;
}
/* /*
============================================================================== ==============================================================================
@ -1113,27 +1095,11 @@ void COM_Init (char *basedir)
{ {
byte swaptest[2] = {1,0}; byte swaptest[2] = {1,0};
// set the byte swapping variables in a portable manner // force set little endian to be cool and fast
if ( *(short *)swaptest == 1) bigendien = false;
{ BigShort = ShortSwap;
bigendien = false; BigLong = LongSwap;
BigShort = ShortSwap; BigFloat = FloatSwap;
LittleShort = ShortNoSwap;
BigLong = LongSwap;
LittleLong = LongNoSwap;
BigFloat = FloatSwap;
LittleFloat = FloatNoSwap;
}
else
{
bigendien = true;
BigShort = ShortNoSwap;
LittleShort = ShortSwap;
BigLong = LongNoSwap;
LittleLong = LongSwap;
BigFloat = FloatNoSwap;
LittleFloat = FloatSwap;
}
Cvar_RegisterVariable (&cmdline); Cvar_RegisterVariable (&cmdline);
Cmd_AddCommand ("path", COM_Path_f); Cmd_AddCommand ("path", COM_Path_f);

View file

@ -110,9 +110,10 @@ extern qboolean bigendien;
extern short (*BigShort) (short l); extern short (*BigShort) (short l);
extern short (*LittleShort) (short l); extern short (*LittleShort) (short l);
extern int (*BigLong) (int l); extern int (*BigLong) (int l);
extern int (*LittleLong) (int l);
extern float (*BigFloat) (float l); #define LittleLong(l) l
extern float (*LittleFloat) (float l); #define LittleShort(l) l
#define LittleFloat(l) l
//============================================================================ //============================================================================