diff options
author | Levi <L3ehunin@gmail.com> | 2021-01-10 22:09:56 -0700 |
---|---|---|
committer | Levi <L3ehunin@gmail.com> | 2021-01-10 22:09:56 -0700 |
commit | 7a3c884e39fccfbb498b855080bffabc9ce2e7f1 (patch) | |
tree | 5056f9406dec188439cb0deb87603498243a9412 /src/common/math_util.h | |
parent | bc69cc151192326f9b8e18bbda831f1589ba27e0 (diff) | |
parent | 46cd71d1c773c29cce8b48e7e2b478bdf6d77085 (diff) |
Merge remote-tracking branch 'upstream/master' into int-flags
Diffstat (limited to 'src/common/math_util.h')
-rw-r--r-- | src/common/math_util.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/common/math_util.h b/src/common/math_util.h index b35ad8507..4c38d8040 100644 --- a/src/common/math_util.h +++ b/src/common/math_util.h @@ -20,14 +20,14 @@ struct Rectangle { constexpr Rectangle() = default; - constexpr Rectangle(T left, T top, T right, T bottom) - : left(left), top(top), right(right), bottom(bottom) {} + constexpr Rectangle(T left_, T top_, T right_, T bottom_) + : left(left_), top(top_), right(right_), bottom(bottom_) {} [[nodiscard]] T GetWidth() const { if constexpr (std::is_floating_point_v<T>) { return std::abs(right - left); } else { - return std::abs(static_cast<std::make_signed_t<T>>(right - left)); + return static_cast<T>(std::abs(static_cast<std::make_signed_t<T>>(right - left))); } } @@ -35,7 +35,7 @@ struct Rectangle { if constexpr (std::is_floating_point_v<T>) { return std::abs(bottom - top); } else { - return std::abs(static_cast<std::make_signed_t<T>>(bottom - top)); + return static_cast<T>(std::abs(static_cast<std::make_signed_t<T>>(bottom - top))); } } |