From ada4548ce914a652e3f7f2a239692f732c538399 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sun, 5 Apr 2020 19:48:17 -0500 Subject: [PATCH] [ox/std] Fix implicit sign conversion (synced from 8b7492027039fff9b55cdf195033e2503953bd3f) --- src/ox/std/CMakeLists.txt | 2 ++ src/ox/std/bit.hpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ox/std/CMakeLists.txt b/src/ox/std/CMakeLists.txt index 00d18b161..e327ec7a5 100644 --- a/src/ox/std/CMakeLists.txt +++ b/src/ox/std/CMakeLists.txt @@ -13,6 +13,8 @@ add_library( trace.cpp ) +target_compile_options(OxStd PRIVATE -Wsign-conversion) + if(NOT OX_BARE_METAL) set_property( TARGET diff --git a/src/ox/std/bit.hpp b/src/ox/std/bit.hpp index cfde87969..ef68c8b46 100644 --- a/src/ox/std/bit.hpp +++ b/src/ox/std/bit.hpp @@ -24,7 +24,7 @@ typename enable_if::type bit_cast(From src) noex template [[nodiscard]] constexpr T rotl(T i, int shift) noexcept { constexpr auto bits = sizeof(i) * 8; - return (i << shift) | (i >> (bits - shift)); + return (i << static_cast(shift)) | (i >> (bits - static_cast(shift))); } template