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;
}
short ShortNoSwap (short l)
static inline short ShortNoSwap (short l)
{
return l;
}
@ -469,7 +469,7 @@ int LongSwap (int l)
return ((int)b1<<24) + ((int)b2<<16) + ((int)b3<<8) + b4;
}
int LongNoSwap (int l)
static inline int LongNoSwap (int l)
{
return l;
}
@ -491,7 +491,7 @@ float FloatSwap (float f)
return dat2.f;
}
float FloatNoSwap (float f)
static inline float FloatNoSwap (float f)
{
return f;
}
@ -1180,27 +1180,14 @@ void COM_Init (char *basedir)
{
byte swaptest[2] = {1,0};
// set the byte swapping variables in a portable manner
if ( *(short *)swaptest == 1)
{
bigendien = false;
BigShort = ShortSwap;
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;
}
// force set little endian to be cool and fast
bigendien = false;
BigShort = ShortSwap;
LittleShort = ShortNoSwap;
BigLong = LongSwap;
LittleLong = LongNoSwap;
BigFloat = FloatSwap;
LittleFloat = FloatNoSwap;
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];
}
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]);
}