mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:27:34 +00:00
AK: Fix warnings when using FixedPoint with a precision >= 32 bits
This commit is contained in:
parent
f021baf255
commit
06fc72ca0c
1 changed files with 3 additions and 3 deletions
|
@ -18,19 +18,19 @@ namespace AK {
|
||||||
template<size_t precision, typename Underlying>
|
template<size_t precision, typename Underlying>
|
||||||
class FixedPoint {
|
class FixedPoint {
|
||||||
using This = FixedPoint<precision, Underlying>;
|
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:
|
public:
|
||||||
constexpr FixedPoint() = default;
|
constexpr FixedPoint() = default;
|
||||||
template<Integral I>
|
template<Integral I>
|
||||||
constexpr FixedPoint(I value)
|
constexpr FixedPoint(I value)
|
||||||
: m_value(value << precision)
|
: m_value(static_cast<Underlying>(value) << precision)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template<FloatingPoint F>
|
template<FloatingPoint F>
|
||||||
constexpr FixedPoint(F value)
|
constexpr FixedPoint(F value)
|
||||||
: m_value(static_cast<Underlying>(value * (1u << precision)))
|
: m_value(static_cast<Underlying>(value * (static_cast<Underlying>(1) << precision)))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue