From 854e97f57c21c9809016a955fa1c90e1e2f2f2d1 Mon Sep 17 00:00:00 2001 From: Josiah VanderZee Date: Sat, 16 Dec 2023 12:14:55 -0600 Subject: [PATCH] Add size_t to u32/s32 static_casts in irrArray This fixes 5 narrowing cast warnings from Visual Studio 17 2022. --- include/irrArray.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/irrArray.h b/include/irrArray.h index eef7be1..5c1c75c 100644 --- a/include/irrArray.h +++ b/include/irrArray.h @@ -241,7 +241,7 @@ public: /** \return Size of elements in the array which are actually occupied. */ u32 size() const { - return m_data.size(); + return static_cast(m_data.size()); } @@ -317,7 +317,7 @@ public: // *it = first element in [first, last) that is >= element, or last if not found. if (*it < element || element < *it) return -1; - return it - m_data.begin(); + return static_cast(it - m_data.begin()); } @@ -335,8 +335,8 @@ public: auto iters = std::equal_range(m_data.begin(), m_data.end(), element); if (iters.first == iters.second) return -1; - last = (iters.second - m_data.begin()) - 1; - return iters.first - m_data.begin(); + last = static_cast((iters.second - m_data.begin()) - 1); + return static_cast(iters.first - m_data.begin()); } @@ -351,7 +351,7 @@ public: auto it = std::find(m_data.begin(), m_data.end(), element); if (it == m_data.end()) return -1; - return it - m_data.begin(); + return static_cast(it - m_data.begin()); }