proper inline this
This commit is contained in:
1 parent
9eec9f7e52
commit
651e5a4924
2 files changed
+22
-25
No files matched your search
@@ -26,26 +26,6 @@
|
||||
|
||||
#include "tables.h"
|
||||
|
||||
FUNCINLINE ATTRINLINE unsigned SlopeDiv(unsigned num, unsigned den)
|
||||
{
|
||||
unsigned ans;
|
||||
num <<= (FINE_FRACBITS-FRACBITS);
|
||||
den <<= (FINE_FRACBITS-FRACBITS);
|
||||
if (den < 512)
|
||||
return SLOPERANGE;
|
||||
ans = (num<<3) / (den>>8);
|
||||
return ans <= SLOPERANGE ? ans : SLOPERANGE;
|
||||
}
|
||||
|
||||
FUNCINLINE ATTRINLINE UINT64 SlopeDivEx(unsigned int num, unsigned int den)
|
||||
{
|
||||
UINT64 ans;
|
||||
if (den < 512)
|
||||
return SLOPERANGE;
|
||||
ans = ((UINT64)num<<3)/(den>>8);
|
||||
return ans <= SLOPERANGE ? ans : SLOPERANGE;
|
||||
}
|
||||
|
||||
fixed_t AngleFixed(angle_t af)
|
||||
{
|
||||
angle_t wa = ANGLE_180;
|
||||
|
||||
+22
-5
@@ -73,6 +73,9 @@ extern fixed_t finetangent[FINEANGLES/2];
|
||||
|
||||
typedef UINT32 angle_t;
|
||||
|
||||
// The table values in tables.c are calculated with this many fractional bits.
|
||||
#define FINE_FRACBITS 16
|
||||
|
||||
// To get a global angle from Cartesian coordinates, the coordinates are
|
||||
// flipped until they are in the first octant of the coordinate system, then
|
||||
// the y (<=x) is scaled and divided by x to get a tangent (slope) value
|
||||
@@ -85,9 +88,26 @@ typedef UINT32 angle_t;
|
||||
extern angle_t tantoangle[SLOPERANGE+1];
|
||||
|
||||
// Utility function, called by R_PointToAngle.
|
||||
FUNCMATH unsigned SlopeDiv(unsigned num, unsigned den);
|
||||
FUNCINLINE static ATTRINLINE unsigned SlopeDiv(unsigned num, unsigned den)
|
||||
{
|
||||
unsigned ans;
|
||||
num <<= (FINE_FRACBITS-FRACBITS);
|
||||
den <<= (FINE_FRACBITS-FRACBITS);
|
||||
if (den < 512)
|
||||
return SLOPERANGE;
|
||||
ans = (num<<3) / (den>>8);
|
||||
return ans <= SLOPERANGE ? ans : SLOPERANGE;
|
||||
}
|
||||
|
||||
// Only called by R_PointToAngle64
|
||||
FUNCMATH UINT64 SlopeDivEx(unsigned int num, unsigned int den);
|
||||
FUNCINLINE static ATTRINLINE UINT64 SlopeDivEx(unsigned int num, unsigned int den)
|
||||
{
|
||||
UINT64 ans;
|
||||
if (den < 512)
|
||||
return SLOPERANGE;
|
||||
ans = ((UINT64)num<<3)/(den>>8);
|
||||
return ans <= SLOPERANGE ? ans : SLOPERANGE;
|
||||
}
|
||||
|
||||
// 360 - angle_t(ANGLE_45) = ANGLE_315
|
||||
FUNCMATH FUNCINLINE static ATTRINLINE angle_t InvAngle(angle_t a)
|
||||
@@ -122,9 +142,6 @@ void FV3_Rotate(vector3_t *rotVec, const vector3_t *axisVec, const angle_t angle
|
||||
/// Fixed Point Matrix functions
|
||||
void FM_Rotate(matrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z);
|
||||
|
||||
// The table values in tables.c are calculated with this many fractional bits.
|
||||
#define FINE_FRACBITS 16
|
||||
|
||||
// These macros should be used in case FRACBITS < FINE_FRACBITS.
|
||||
#define FINESINE(n) (finesine[n]>>(FINE_FRACBITS-FRACBITS))
|
||||
#define FINECOSINE(n) (finecosine[n]>>(FINE_FRACBITS-FRACBITS))
|
||||
|
||||
Reference in new issue
Block a user