diff options
| author | 2022-10-18 13:05:08 -0400 | |
|---|---|---|
| committer | 2022-10-18 16:06:50 -0400 | |
| commit | 0101ef9fb115e59f1b9b7a28890104b115eb184d (patch) | |
| tree | 93f220b72dd2ccea271aeefb938aa8d9f072975d | |
| parent | fixed_point: Use defaulted comparisons (diff) | |
| download | yuzu-0101ef9fb115e59f1b9b7a28890104b115eb184d.tar.gz yuzu-0101ef9fb115e59f1b9b7a28890104b115eb184d.tar.xz yuzu-0101ef9fb115e59f1b9b7a28890104b115eb184d.zip | |
fixed_point: Make to_uint() non-const
This calls round_up(), which is a non-const member function, so if a
fixed-point instantiation ever calls to_uint(), it'll result in a
compiler error.
This allows the member function to work.
While we're at it, we can actually mark to_long_floor() as const, since
it's not modifying any member state.
Diffstat (limited to '')
| -rw-r--r-- | src/common/fixed_point.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/fixed_point.h b/src/common/fixed_point.h index 7f00dd7b5..116dfbb33 100644 --- a/src/common/fixed_point.h +++ b/src/common/fixed_point.h | |||
| @@ -411,7 +411,7 @@ public: // conversion to basic types | |||
| 411 | return static_cast<int>((data_ & integer_mask) >> fractional_bits); | 411 | return static_cast<int>((data_ & integer_mask) >> fractional_bits); |
| 412 | } | 412 | } |
| 413 | 413 | ||
| 414 | constexpr unsigned int to_uint() const { | 414 | constexpr unsigned int to_uint() { |
| 415 | round_up(); | 415 | round_up(); |
| 416 | return static_cast<unsigned int>((data_ & integer_mask) >> fractional_bits); | 416 | return static_cast<unsigned int>((data_ & integer_mask) >> fractional_bits); |
| 417 | } | 417 | } |
| @@ -425,7 +425,7 @@ public: // conversion to basic types | |||
| 425 | return static_cast<int>((data_ & integer_mask) >> fractional_bits); | 425 | return static_cast<int>((data_ & integer_mask) >> fractional_bits); |
| 426 | } | 426 | } |
| 427 | 427 | ||
| 428 | constexpr int64_t to_long_floor() { | 428 | constexpr int64_t to_long_floor() const { |
| 429 | return static_cast<int64_t>((data_ & integer_mask) >> fractional_bits); | 429 | return static_cast<int64_t>((data_ & integer_mask) >> fractional_bits); |
| 430 | } | 430 | } |
| 431 | 431 | ||