From 5a0e17e6a406805e830fc78b681656d0c7e88748 Mon Sep 17 00:00:00 2001 From: batsumaru <> Date: Sun, 9 Aug 2026 11:35:34 +0900 Subject: Avoid UB from poorly implemented signed overflow --- src/fixed_point.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/fixed_point.cpp') diff --git a/src/fixed_point.cpp b/src/fixed_point.cpp index 3e67e77..7ff77a0 100644 --- a/src/fixed_point.cpp +++ b/src/fixed_point.cpp @@ -1,7 +1,7 @@ #include "fixed_point.h" fp_t fp_t::operator+(const fp_t& other) const { - return {raw + other.raw}; + return {(int32_t)((uint32_t)raw + (uint32_t)other.raw)}; } bool fp_t::operator==(const fp_t& other) const { -- cgit v1.3