summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbatsumaru <>2026-08-09 11:35:34 +0900
committerbatsumaru <>2026-08-09 11:35:34 +0900
commit5a0e17e6a406805e830fc78b681656d0c7e88748 (patch)
treea805a2e7bdebc56b57d0c083c21d094bdae40d28 /src
parent28fd42b64ae2878114225bea8ede2fb16d466908 (diff)
Avoid UB from poorly implemented signed overflow
Diffstat (limited to 'src')
-rw-r--r--src/fixed_point.cpp2
1 files changed, 1 insertions, 1 deletions
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 {