do this instead
This commit is contained in:
1 parent
58bf1572de
commit
16db0ba290
1 file changed
+4
-3
+4
-3
@@ -116,9 +116,10 @@ FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSegSide(fixed_t x, fixed_t
|
||||
y -= ly;
|
||||
|
||||
// Try to quickly decide by looking at sign bits.
|
||||
if ((ldy ^ ldx ^ x ^ y) < 0)
|
||||
return (ldy ^ x) < 0; // (left is negative)
|
||||
return FixedMul(y, ldx>>FRACBITS) >= FixedMul(ldy>>FRACBITS, x);
|
||||
// also use a mask to avoid branch prediction
|
||||
INT32 mask = (ldy ^ ldx ^ x ^ y) >> 31;
|
||||
return (mask & ((ldy ^ x) < 0)) | // (left is negative)
|
||||
(~mask & (FixedMul(y, ldx>>FRACBITS) >= FixedMul(ldy>>FRACBITS, x)));
|
||||
}
|
||||
|
||||
angle_t R_PointToAngle(fixed_t x, fixed_t y);
|
||||
|
||||
Reference in new issue
Block a user