mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
AK: Fix warnings when using FixedPoint with a precision >= 32 bits
This commit is contained in:
parent
f021baf255
commit
06fc72ca0c
Notes:
sideshowbarker
2024-07-18 22:57:59 +09:00
Author: https://github.com/tomuta Commit: https://github.com/SerenityOS/serenity/commit/06fc72ca0cf Pull-request: https://github.com/SerenityOS/serenity/pull/11439 Reviewed-by: https://github.com/kleinesfilmroellchen Reviewed-by: https://github.com/linusg ✅
1 changed files with 3 additions and 3 deletions
|
@ -18,19 +18,19 @@ namespace AK {
|
|||
template<size_t precision, typename Underlying>
|
||||
class FixedPoint {
|
||||
using This = FixedPoint<precision, Underlying>;
|
||||
constexpr static Underlying radix_mask = (1 << precision) - 1;
|
||||
constexpr static Underlying radix_mask = (static_cast<Underlying>(1) << precision) - 1;
|
||||
|
||||
public:
|
||||
constexpr FixedPoint() = default;
|
||||
template<Integral I>
|
||||
constexpr FixedPoint(I value)
|
||||
: m_value(value << precision)
|
||||
: m_value(static_cast<Underlying>(value) << precision)
|
||||
{
|
||||
}
|
||||
|
||||
template<FloatingPoint F>
|
||||
constexpr FixedPoint(F value)
|
||||
: m_value(static_cast<Underlying>(value * (1u << precision)))
|
||||
: m_value(static_cast<Underlying>(value * (static_cast<Underlying>(1) << precision)))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue