From 88389ae0cac098bdf9a1f59331489ee69facd84c Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Wed, 13 Jul 2022 12:20:49 -0500 Subject: [PATCH] a/math: Resolve warnings. --- src/xrt/auxiliary/math/m_relation_history.cpp | 8 ++++---- src/xrt/auxiliary/math/m_space.h | 20 ++++++++----------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/xrt/auxiliary/math/m_relation_history.cpp b/src/xrt/auxiliary/math/m_relation_history.cpp index e10737fb5..72f1f7e31 100644 --- a/src/xrt/auxiliary/math/m_relation_history.cpp +++ b/src/xrt/auxiliary/math/m_relation_history.cpp @@ -132,8 +132,8 @@ m_relation_history_get(struct m_relation_history *rh, uint64_t at_timestamp_ns, // We precede *it and follow *(it - 1) (which we know exists because we already handled // the it = begin() case) - auto predecessor = *(it - 1); - auto successor = *it; + const auto &predecessor = *(it - 1); + const auto &successor = *it; // Do the thing. int64_t diff_before = static_cast(at_timestamp_ns) - predecessor.timestamp; @@ -187,7 +187,7 @@ m_relation_history_estimate_motion(struct m_relation_history *rh, return false; }; - float dt = time_ns_to_s(timestamp - last_time_ns); + float dt = (float)time_ns_to_s(timestamp - last_time_ns); // Used to find out what values are valid in both the old relation and the new relation enum xrt_space_relation_flags tmp_flags = @@ -245,7 +245,7 @@ void m_relation_history_clear(struct m_relation_history *rh) { std::unique_lock lock(rh->mutex); - rh->impl = {}; + rh->impl.clear(); } void diff --git a/src/xrt/auxiliary/math/m_space.h b/src/xrt/auxiliary/math/m_space.h index b12228418..e6e0f13bd 100644 --- a/src/xrt/auxiliary/math/m_space.h +++ b/src/xrt/auxiliary/math/m_space.h @@ -36,18 +36,14 @@ m_pose_is_identity(struct xrt_pose *pose) { struct xrt_pose p = *pose; - if ((p.position.x == 0.0f || p.position.x == -0.0f) && // x - (p.position.y == 0.0f || p.position.y == -0.0f) && // y - (p.position.z == 0.0f || p.position.z == -0.0f) && // z - (p.orientation.x == 0.0f || p.orientation.x == -0.0f) && // x - (p.orientation.y == 0.0f || p.orientation.y == -0.0f) && // y - (p.orientation.z == 0.0f || p.orientation.z == -0.0f) && // z - (p.orientation.w == 1.0f || p.orientation.w == -1.0f) // w - ) { - return true; - } - - return false; + return ((p.position.x == 0.0f || p.position.x == -0.0f) && // x + (p.position.y == 0.0f || p.position.y == -0.0f) && // y + (p.position.z == 0.0f || p.position.z == -0.0f) && // z + (p.orientation.x == 0.0f || p.orientation.x == -0.0f) && // x + (p.orientation.y == 0.0f || p.orientation.y == -0.0f) && // y + (p.orientation.z == 0.0f || p.orientation.z == -0.0f) && // z + (p.orientation.w == 1.0f || p.orientation.w == -1.0f) // w + ); }