diff options
| author | batsumaru <> | 2026-08-09 11:35:34 +0900 |
|---|---|---|
| committer | batsumaru <> | 2026-08-09 11:35:34 +0900 |
| commit | 5a0e17e6a406805e830fc78b681656d0c7e88748 (patch) | |
| tree | a805a2e7bdebc56b57d0c083c21d094bdae40d28 /src/fixed_point.cpp | |
| parent | 28fd42b64ae2878114225bea8ede2fb16d466908 (diff) | |
Avoid UB from poorly implemented signed overflow
Diffstat (limited to 'src/fixed_point.cpp')
| -rw-r--r-- | src/fixed_point.cpp | 2 |
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 { |
