- undid the workarounds for undefined-ness of negative shifts.

For any mainstream platform that is totally irrelevant and besides, in C++20 it will be well defined and all current compilers on the relevant platforms treat it accordingly.
This is not worth deoptimizing the code.
This commit is contained in:
Christoph Oelckers 2020-09-01 19:47:01 +02:00
parent dfb6c0d6fa
commit c957397573

View file

@ -55,8 +55,7 @@ inline fixed_t FloatToFixed(double f)
inline constexpr fixed_t IntToFixed(int32_t f)
{
// Negative shifts are undefined, so multiply instead of shifting left.
return f * FRACUNIT;
return f << FRACBITS;
}
inline constexpr double FixedToFloat(fixed_t f)
@ -66,7 +65,7 @@ inline constexpr double FixedToFloat(fixed_t f)
inline constexpr int32_t FixedToInt(fixed_t f)
{
return xs_CRoundToInt(FixedToFloat(f));
return (f + FRACUNIT/2) >> FRACBITS;
}
inline constexpr unsigned FloatToAngle(double f)