diff --git a/common/include/maths.h b/common/include/maths.h index 1ffcbb10f..41130dbba 100644 --- a/common/include/maths.h +++ b/common/include/maths.h @@ -37,13 +37,7 @@ typedef int16_t fixang; //angles typedef struct quadint // integer 64 bit, previously called "quad" { - union { - struct { - uint32_t low; - int32_t high; - }; int64_t q; - }; } quadint; @@ -132,12 +126,6 @@ static inline fix fixquadadjust (const quadint *q) return static_cast(q->q >> 16); } -//negate a quadint -static inline void fixquadnegate (quadint * q) -{ - q->q = -q->q; -} - //computes the square root of a long, returning a short [[nodiscard]] ushort long_sqrt (int32_t a); @@ -188,7 +176,7 @@ fixang fix_atan2 (fix cos, fix sin); [[nodiscard]] std::optional checkmuldiv(fix a, fix b, fix divisor); -extern const std::array guess_table; +extern const std::array guess_table; extern const std::array sincos_table; extern const std::array asin_table; extern const std::array acos_table; diff --git a/common/maths/fixc.cpp b/common/maths/fixc.cpp index e9fad76b0..dd2a0d0f3 100644 --- a/common/maths/fixc.cpp +++ b/common/maths/fixc.cpp @@ -105,8 +105,8 @@ static unsigned fixdivquadlongu(quadint n, uint64_t d) uint32_t quad_sqrt(const quadint iq) { - const uint32_t low = iq.low; - const int32_t high = iq.high; + const uint32_t low = static_cast(iq.q); + const int32_t high = static_cast(iq.q >> 32); int i, cnt; uint32_t r,old_r,t; diff --git a/common/maths/tables.cpp b/common/maths/tables.cpp index 862b393e2..43e2e3d47 100644 --- a/common/maths/tables.cpp +++ b/common/maths/tables.cpp @@ -15,7 +15,7 @@ namespace dcx { -const std::array guess_table{{ +constexpr std::array guess_table{{ 1, 1,1,1, 2,2,2,2,2,