From a32f6e9d8e994bfdc5a1f67c38dd3a5123710440 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Wed, 1 Jun 2022 01:40:18 -0400 Subject: [PATCH] gdbstub: Explicitly cast return type to u8 Otherwise, the addition promotes the returned value to an int instead of keeping it as a u8. --- src/core/debugger/gdbstub.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/debugger/gdbstub.cpp b/src/core/debugger/gdbstub.cpp index 718c45952d..ee75981658 100644 --- a/src/core/debugger/gdbstub.cpp +++ b/src/core/debugger/gdbstub.cpp @@ -358,8 +358,8 @@ std::optional GDBStub::DetachCommand() { } u8 GDBStub::CalculateChecksum(std::string_view data) { - return static_cast( - 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(lhs + rhs); }); } void GDBStub::SendReply(std::string_view data) {