Stop pretending we support big endian, inline some stuff.

This commit is contained in:
Steam Deck User 2023-02-13 13:29:59 -05:00
parent 8194bfc257
commit 7aa4b8578d
2 changed files with 12 additions and 25 deletions

View file

@ -452,7 +452,7 @@ short ShortSwap (short l)
return (b1<<8) + b2; return (b1<<8) + b2;
} }
short ShortNoSwap (short l) static inline short ShortNoSwap (short l)
{ {
return l; return l;
} }
@ -469,7 +469,7 @@ 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) static inline int LongNoSwap (int l)
{ {
return l; return l;
} }
@ -491,7 +491,7 @@ float FloatSwap (float f)
return dat2.f; return dat2.f;
} }
float FloatNoSwap (float f) static inline float FloatNoSwap (float f)
{ {
return f; return f;
} }
@ -1180,9 +1180,7 @@ 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; bigendien = false;
BigShort = ShortSwap; BigShort = ShortSwap;
LittleShort = ShortNoSwap; LittleShort = ShortNoSwap;
@ -1190,17 +1188,6 @@ void COM_Init (char *basedir)
LittleLong = LongNoSwap; LittleLong = LongNoSwap;
BigFloat = FloatSwap; BigFloat = FloatSwap;
LittleFloat = FloatNoSwap; LittleFloat = FloatNoSwap;
}
else
{
bigendien = true;
BigShort = ShortNoSwap;
LittleShort = ShortSwap;
BigLong = LongNoSwap;
LittleLong = LongSwap;
BigFloat = FloatNoSwap;
LittleFloat = FloatSwap;
}
Cmd_AddCommand ("path", COM_Path_f); Cmd_AddCommand ("path", COM_Path_f);

View file

@ -543,7 +543,7 @@ void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross)
cross[2] = v1[0]*v2[1] - v1[1]*v2[0]; cross[2] = v1[0]*v2[1] - v1[1]*v2[0];
} }
vec_t Length(vec3_t v) inline vec_t Length(vec3_t v)
{ {
return sqrtf(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); return sqrtf(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
} }