From be1954e04cb5a0c3a526f78ed5490a5e65310280 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 15 Oct 2020 14:49:45 -0400 Subject: core: Fix clang build Recent changes to the build system that made more warnings be flagged as errors caused building via clang to break. Fixes #4795 --- src/core/hle/kernel/memory/page_heap.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/core/hle/kernel/memory/page_heap.h') diff --git a/src/core/hle/kernel/memory/page_heap.h b/src/core/hle/kernel/memory/page_heap.h index 22b0de860..92a2bce04 100644 --- a/src/core/hle/kernel/memory/page_heap.h +++ b/src/core/hle/kernel/memory/page_heap.h @@ -34,7 +34,9 @@ public: static constexpr s32 GetBlockIndex(std::size_t num_pages) { for (s32 i{static_cast(NumMemoryBlockPageShifts) - 1}; i >= 0; i--) { - if (num_pages >= (static_cast(1) << MemoryBlockPageShifts[i]) / PageSize) { + const auto shift_index = static_cast(i); + if (num_pages >= + (static_cast(1) << MemoryBlockPageShifts[shift_index]) / PageSize) { return i; } } @@ -86,7 +88,7 @@ private: // Set the bitmap pointers for (s32 depth{GetHighestDepthIndex()}; depth >= 0; depth--) { - bit_storages[depth] = storage; + bit_storages[static_cast(depth)] = storage; size = Common::AlignUp(size, 64) / 64; storage += size; } @@ -99,7 +101,7 @@ private: s32 depth{}; do { - const u64 v{bit_storages[depth][offset]}; + const u64 v{bit_storages[static_cast(depth)][offset]}; if (v == 0) { // Non-zero depth indicates that a previous level had a free block ASSERT(depth == 0); @@ -125,7 +127,7 @@ private: constexpr bool ClearRange(std::size_t offset, std::size_t count) { const s32 depth{GetHighestDepthIndex()}; const auto bit_ind{offset / 64}; - u64* bits{bit_storages[depth]}; + u64* bits{bit_storages[static_cast(depth)]}; if (count < 64) { const auto shift{offset % 64}; ASSERT(shift + count <= 64); @@ -177,11 +179,11 @@ private: const auto which{offset % 64}; const u64 mask{1ULL << which}; - u64* bit{std::addressof(bit_storages[depth][ind])}; + u64* bit{std::addressof(bit_storages[static_cast(depth)][ind])}; const u64 v{*bit}; ASSERT((v & mask) == 0); *bit = v | mask; - if (v) { + if (v != 0) { break; } offset = ind; @@ -195,12 +197,12 @@ private: const auto which{offset % 64}; const u64 mask{1ULL << which}; - u64* bit{std::addressof(bit_storages[depth][ind])}; + u64* bit{std::addressof(bit_storages[static_cast(depth)][ind])}; u64 v{*bit}; ASSERT((v & mask) != 0); v &= ~mask; *bit = v; - if (v) { + if (v != 0) { break; } offset = ind; -- cgit v1.2.3