Revert "optimize fixedhypot"
This reverts commit ae68bd577558f45b81741396a899b7c311f753fc.
This commit is contained in:
1 parent
360df11aa6
commit
b1cfdfbc14
1 file changed
+6
-13
+6
-13
@@ -61,8 +61,6 @@ fixed_t FixedSqrt(fixed_t x)
|
||||
#endif
|
||||
}
|
||||
|
||||
#define MAXINT2 ((int)0x7fffffff)
|
||||
|
||||
fixed_t FixedHypot(fixed_t x, fixed_t y)
|
||||
{
|
||||
// Moved the code from R_PointToDist2 to here,
|
||||
@@ -71,35 +69,30 @@ fixed_t FixedHypot(fixed_t x, fixed_t y)
|
||||
|
||||
angle_t angle;
|
||||
fixed_t dist;
|
||||
fixed_t temp;
|
||||
|
||||
x = abs(x);
|
||||
y = abs(y);
|
||||
|
||||
if (y > x)
|
||||
{
|
||||
fixed_t temp_var = x;
|
||||
fixed_t temp;
|
||||
|
||||
temp = x;
|
||||
x = y;
|
||||
y = temp_var;
|
||||
y = temp;
|
||||
}
|
||||
|
||||
if (!y)
|
||||
return x;
|
||||
|
||||
//angle = (tantoangle[FixedDiv(y, x)>>DBITS] + ANGLE_90) >> ANGLETOFINESHIFT;
|
||||
angle = (tantoangle[((y >> 14 >= x) ? ((y ^ x) >> 31) ^ MAXINT2 : FixedDiv2(y, x)) >> DBITS] + ANGLE_90) >> ANGLETOFINESHIFT;
|
||||
angle = (tantoangle[FixedDiv(y, x)>>DBITS] + ANGLE_90) >> ANGLETOFINESHIFT;
|
||||
|
||||
// use as cosine
|
||||
//dist = FixedDiv(x, FINESINE(angle));
|
||||
|
||||
temp = finesine[angle];
|
||||
dist = ((x >> 14) >= abs(temp)) ? ((x ^ temp) >> 31) ^ MAXINT2 : FixedDiv2(x, temp);
|
||||
dist = FixedDiv(x, FINESINE(angle));
|
||||
|
||||
return dist;
|
||||
}
|
||||
|
||||
#undef MAXINT2
|
||||
|
||||
vector2_t *FV2_Load(vector2_t *vec, fixed_t x, fixed_t y)
|
||||
{
|
||||
vec->x = x;
|
||||
|
||||
Reference in new issue
Block a user