diff options
| author | batsumaru <> | 2026-08-09 12:39:50 +0900 |
|---|---|---|
| committer | batsumaru <> | 2026-08-09 12:39:50 +0900 |
| commit | 7bb49794297b46aa1c577e89da24d39b4348c6d4 (patch) | |
| tree | 89b1d4a1f044546e15fbbd0dde370eddc6e7b4b9 /include | |
| parent | 9d4f68606c919791d44e86e7a50812c29be32fa3 (diff) | |
Added fp_t multiplication
Diffstat (limited to 'include')
| -rw-r--r-- | include/fixed_point.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/fixed_point.h b/include/fixed_point.h index 1bdc5df..ff8e2b3 100644 --- a/include/fixed_point.h +++ b/include/fixed_point.h @@ -5,6 +5,8 @@ #include <type_traits> struct fp_t { + static constexpr int32_t Q = 16; + static constexpr int32_t K = 1 << (Q - 1); std::int32_t raw; static constexpr fp_t from_raw(std::int32_t r) { return fp_t{r}; } @@ -12,6 +14,7 @@ struct fp_t { fp_t operator+(const fp_t& other) const; fp_t operator-(const fp_t& other) const; + fp_t operator*(const fp_t& other) const; bool operator==(const fp_t& other) const; }; |
