- added conversion macros to convert floating point angles to angle_t, using xs_Float.h, and replaced all occurences in the code with them (let's hope I found everything.)
Converting a floating point value that is out of range for a signed integer will result in 0x80000000 with SSE math, which is used exclusively for this purpose on modern Visual C++ compilers, so this cannot be used anywhere. On ARM there's problems with float to unsigned int conversions. xs_Float does not depend on these
This commit is contained in:
parent
7b42093dc9
commit
6d0ef7a9da
18 changed files with 58 additions and 46 deletions
|
|
@ -1236,3 +1236,16 @@ CCMD(secret)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
CCMD(angleconvtest)
|
||||
{
|
||||
Printf("Testing degrees to angle conversion:\n");
|
||||
for (double ang = -5 * 180.; ang < 5 * 180.; ang += 45.)
|
||||
{
|
||||
angle_t ang1 = FLOAT2ANGLE(ang);
|
||||
angle_t ang2 = (angle_t)(ang * (ANGLE_90 / 90.));
|
||||
angle_t ang3 = (angle_t)(int)(ang * (ANGLE_90 / 90.));
|
||||
Printf("Angle = %.5f: xs_RoundToInt = %08x, unsigned cast = %08x, signed cast = %08x\n",
|
||||
ang, ang1, ang2, ang3);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue