Просмотр исходного кода

gdbstub: Explicitly cast return type to u8

Otherwise, the addition promotes the returned value to an int instead of keeping it as a u8.
Morph 4 лет назад
Родитель
Сommit
a32f6e9d8e
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      src/core/debugger/gdbstub.cpp

+ 2 - 2
src/core/debugger/gdbstub.cpp

@@ -358,8 +358,8 @@ std::optional<std::string> GDBStub::DetachCommand() {
 }
 }
 
 
 u8 GDBStub::CalculateChecksum(std::string_view data) {
 u8 GDBStub::CalculateChecksum(std::string_view data) {
-    return static_cast<u8>(
-        std::accumulate(data.begin(), data.end(), u8{0}, [](u8 lhs, u8 rhs) { return lhs + rhs; }));
+    return std::accumulate(data.begin(), data.end(), u8{0},
+                           [](u8 lhs, u8 rhs) { return static_cast<u8>(lhs + rhs); });
 }
 }
 
 
 void GDBStub::SendReply(std::string_view data) {
 void GDBStub::SendReply(std::string_view data) {