Skip to content

Commit

Permalink
GCC12 std::bit_width return value is unsigned
Browse files Browse the repository at this point in the history
  • Loading branch information
higaski committed Aug 11, 2023
1 parent 380e7f3 commit 9c16ba1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"label": "CMake DCCTests Clang",
"type": "shell",
"isBackground": true,
"command": "cmake -Bbuild -GNinja -DCMAKE_TOOLCHAIN_FILE=CMakeModules/toolchains/clang.cmake -DCMAKE_BUILD_TYPE=Debug"
"command": "cmake -Bbuild -GNinja -DCMAKE_TOOLCHAIN_FILE=CMakeModules/src/toolchains/clang.cmake -DCMAKE_BUILD_TYPE=Debug"
},
{
"label": "CMake DCCTests",
Expand Down
3 changes: 3 additions & 0 deletions examples/repl/decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ void Decoder::emergencyStop(uint32_t addr) {
cli::Cli::cout() << "Address " << addr << ": e-stop" << PROMPTENDL;
}

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
void Decoder::function(uint32_t addr, uint32_t mask, uint32_t state) {
auto const f_high{std::bit_width(mask) - 1};
auto const f_low{std::countr_zero(mask)};
Expand All @@ -36,6 +38,7 @@ void Decoder::function(uint32_t addr, uint32_t mask, uint32_t state) {
cli::Cli::cout() << static_cast<bool>(state & (1u << i));
cli::Cli::cout() << PROMPTENDL;
}
#pragma GCC diagnostic pop

void Decoder::serviceModeHook(bool) {}

Expand Down

0 comments on commit 9c16ba1

Please sign in to comment.