[teagba] Fix type conversions

This commit is contained in:
Gary Talent 2023-06-07 21:14:39 -05:00
parent f5b1da09b5
commit ae3f0bb5db
2 changed files with 9 additions and 4 deletions

View File

@ -9,7 +9,7 @@
namespace teagba {
inline auto bgSetSbb(volatile BgCtl *bgCtl, unsigned sbb) noexcept {
*bgCtl = (*bgCtl & ~0b11111'0000'0000u) | (sbb << 8);
*bgCtl = static_cast<BgCtl>(*bgCtl & ~0b11111'0000'0000u) | static_cast<BgCtl>(sbb << 8);
}
[[nodiscard]]
@ -24,7 +24,7 @@ inline auto bgPri(const volatile BgCtl *bgCtl) noexcept {
inline auto bgSetPri(volatile BgCtl *bgCtl, unsigned pri) noexcept {
pri = pri & 0b1;
*bgCtl = (*bgCtl & ~0b1u) | (pri << 0);
*bgCtl = static_cast<BgCtl>(*bgCtl & ~0b1u) | static_cast<BgCtl>(pri << 0);
}
[[nodiscard]]
@ -58,7 +58,7 @@ inline auto bgCbb(const volatile BgCtl *bgCtl) noexcept {
inline auto bgSetCbb(volatile BgCtl *bgCtl, unsigned cbb) noexcept {
cbb = cbb & 0b11;
*bgCtl = (*bgCtl & ~0b1100u) | (cbb << 2);
*bgCtl = static_cast<BgCtl>(*bgCtl & ~0b1100u) | static_cast<BgCtl>(cbb << 2);
}
constexpr void iterateBgCtl(auto cb) noexcept {

View File

@ -10,6 +10,11 @@ add_library(
gfx.cpp
)
if(NOT MSVC)
target_compile_options(TeaGBA PRIVATE -Wsign-conversion)
target_compile_options(TeaGBA PRIVATE -Wconversion)
endif()
target_include_directories(
TeaGBA PUBLIC
../include
@ -26,4 +31,4 @@ install(
DESTINATION
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
)