diff options
Diffstat (limited to 'src/common/fixed_point.h')
| -rw-r--r-- | src/common/fixed_point.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/common/fixed_point.h b/src/common/fixed_point.h index f899b0d54..29b80c328 100644 --- a/src/common/fixed_point.h +++ b/src/common/fixed_point.h | |||
| @@ -107,7 +107,7 @@ constexpr FixedPoint<I, F> divide( | |||
| 107 | 107 | ||
| 108 | using next_type = typename FixedPoint<I, F>::next_type; | 108 | using next_type = typename FixedPoint<I, F>::next_type; |
| 109 | using base_type = typename FixedPoint<I, F>::base_type; | 109 | using base_type = typename FixedPoint<I, F>::base_type; |
| 110 | constexpr size_t fractional_bits = FixedPoint<I, F>::fractional_bits; | 110 | constexpr static size_t fractional_bits = FixedPoint<I, F>::fractional_bits; |
| 111 | 111 | ||
| 112 | next_type t(numerator.to_raw()); | 112 | next_type t(numerator.to_raw()); |
| 113 | t <<= fractional_bits; | 113 | t <<= fractional_bits; |
| @@ -127,7 +127,7 @@ constexpr FixedPoint<I, F> divide( | |||
| 127 | 127 | ||
| 128 | using unsigned_type = typename FixedPoint<I, F>::unsigned_type; | 128 | using unsigned_type = typename FixedPoint<I, F>::unsigned_type; |
| 129 | 129 | ||
| 130 | constexpr int bits = FixedPoint<I, F>::total_bits; | 130 | constexpr static int bits = FixedPoint<I, F>::total_bits; |
| 131 | 131 | ||
| 132 | if (denominator == 0) { | 132 | if (denominator == 0) { |
| 133 | throw divide_by_zero(); | 133 | throw divide_by_zero(); |
| @@ -198,7 +198,7 @@ constexpr FixedPoint<I, F> multiply( | |||
| 198 | using next_type = typename FixedPoint<I, F>::next_type; | 198 | using next_type = typename FixedPoint<I, F>::next_type; |
| 199 | using base_type = typename FixedPoint<I, F>::base_type; | 199 | using base_type = typename FixedPoint<I, F>::base_type; |
| 200 | 200 | ||
| 201 | constexpr size_t fractional_bits = FixedPoint<I, F>::fractional_bits; | 201 | constexpr static size_t fractional_bits = FixedPoint<I, F>::fractional_bits; |
| 202 | 202 | ||
| 203 | next_type t(static_cast<next_type>(lhs.to_raw()) * static_cast<next_type>(rhs.to_raw())); | 203 | next_type t(static_cast<next_type>(lhs.to_raw()) * static_cast<next_type>(rhs.to_raw())); |
| 204 | t >>= fractional_bits; | 204 | t >>= fractional_bits; |
| @@ -216,9 +216,9 @@ constexpr FixedPoint<I, F> multiply( | |||
| 216 | 216 | ||
| 217 | using base_type = typename FixedPoint<I, F>::base_type; | 217 | using base_type = typename FixedPoint<I, F>::base_type; |
| 218 | 218 | ||
| 219 | constexpr size_t fractional_bits = FixedPoint<I, F>::fractional_bits; | 219 | constexpr static size_t fractional_bits = FixedPoint<I, F>::fractional_bits; |
| 220 | constexpr base_type integer_mask = FixedPoint<I, F>::integer_mask; | 220 | constexpr static base_type integer_mask = FixedPoint<I, F>::integer_mask; |
| 221 | constexpr base_type fractional_mask = FixedPoint<I, F>::fractional_mask; | 221 | constexpr static base_type fractional_mask = FixedPoint<I, F>::fractional_mask; |
| 222 | 222 | ||
| 223 | // more costly but doesn't need a larger type | 223 | // more costly but doesn't need a larger type |
| 224 | const base_type a_hi = (lhs.to_raw() & integer_mask) >> fractional_bits; | 224 | const base_type a_hi = (lhs.to_raw() & integer_mask) >> fractional_bits; |