Skip to content

Commit 080ffa2

Browse files
authored
Remove redundant consts (#64)
Remove consts where constexpr is also in effect as constexpr implies const.
1 parent 15b1b30 commit 080ffa2

File tree

3 files changed

+41
-41
lines changed

3 files changed

+41
-41
lines changed

src/FixedPoints/Details.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,21 +119,21 @@ namespace FIXED_POINTS_DETAILS
119119
struct MsbMask
120120
{
121121
MsbMask() = delete;
122-
constexpr const static LeastUInt<Bits> Value = (1ull << (Bits - 1));
122+
constexpr static LeastUInt<Bits> Value = (1ull << (Bits - 1));
123123
};
124124

125125
template< unsigned Bits >
126126
struct IdentityMask
127127
{
128128
IdentityMask() = delete;
129-
constexpr const static LeastUInt<Bits> Value = 1 | (IdentityMask<Bits - 1>::Value << 1);
129+
constexpr static LeastUInt<Bits> Value = 1 | (IdentityMask<Bits - 1>::Value << 1);
130130
};
131131

132132
template<>
133133
struct IdentityMask<0>
134134
{
135135
IdentityMask() = delete;
136-
constexpr const static LeastUInt<0> Value = 0;
136+
constexpr static LeastUInt<0> Value = 0;
137137
};
138138

139139
#if !defined(FIXED_POINTS_NO_RANDOM)

src/FixedPoints/SFixed.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ template< unsigned Integer, unsigned Fraction >
2626
class SFixed
2727
{
2828
public:
29-
constexpr const static uintmax_t IntegerSize = Integer + 1;
30-
constexpr const static uintmax_t FractionSize = Fraction;
31-
constexpr const static uintmax_t LogicalSize = IntegerSize + FractionSize;
32-
constexpr const static uintmax_t Scale = UINTMAX_C(1) << FractionSize;
29+
constexpr static uintmax_t IntegerSize = Integer + 1;
30+
constexpr static uintmax_t FractionSize = Fraction;
31+
constexpr static uintmax_t LogicalSize = IntegerSize + FractionSize;
32+
constexpr static uintmax_t Scale = UINTMAX_C(1) << FractionSize;
3333

3434
public:
3535
static_assert(LogicalSize <= FIXED_POINTS_DETAILS::BitSize<intmax_t>::Value, "Platform does not have a native type large enough for SFixed.");
@@ -39,22 +39,22 @@ class SFixed
3939
using FractionType = FIXED_POINTS_DETAILS::LeastUInt<FractionSize>;
4040
using InternalType = FIXED_POINTS_DETAILS::LeastInt<LogicalSize>;
4141

42-
constexpr const static uintmax_t InternalSize = FIXED_POINTS_DETAILS::BitSize<InternalType>::Value;
42+
constexpr static uintmax_t InternalSize = FIXED_POINTS_DETAILS::BitSize<InternalType>::Value;
4343

4444
using ShiftType = FIXED_POINTS_DETAILS::LeastUInt<LogicalSize>;
4545
using MaskType = FIXED_POINTS_DETAILS::LeastUInt<LogicalSize>;
4646

4747
public:
48-
constexpr const static ShiftType IntegerShift = FractionSize;
49-
constexpr const static ShiftType FractionShift = 0;
48+
constexpr static ShiftType IntegerShift = FractionSize;
49+
constexpr static ShiftType FractionShift = 0;
5050

51-
constexpr const static MaskType IntegerMask = FIXED_POINTS_DETAILS::IdentityMask<IntegerSize>::Value;
52-
constexpr const static MaskType FractionMask = FIXED_POINTS_DETAILS::IdentityMask<FractionSize>::Value;
51+
constexpr static MaskType IntegerMask = FIXED_POINTS_DETAILS::IdentityMask<IntegerSize>::Value;
52+
constexpr static MaskType FractionMask = FIXED_POINTS_DETAILS::IdentityMask<FractionSize>::Value;
5353

54-
constexpr const static MaskType IdentityMask = (IntegerMask << IntegerShift) | (FractionMask << FractionShift);
54+
constexpr static MaskType IdentityMask = (IntegerMask << IntegerShift) | (FractionMask << FractionShift);
5555

56-
constexpr const static MaskType MidpointMask = FIXED_POINTS_DETAILS::MsbMask<FractionSize>::Value;
57-
constexpr const static MaskType LesserMidpointMask = MidpointMask - 1;
56+
constexpr static MaskType MidpointMask = FIXED_POINTS_DETAILS::MsbMask<FractionSize>::Value;
57+
constexpr static MaskType LesserMidpointMask = MidpointMask - 1;
5858

5959
protected:
6060
class RawType
@@ -114,15 +114,15 @@ class SFixed
114114
SFixed & operator /=(const SFixed & other);
115115

116116
public:
117-
constexpr const static SFixed Epsilon = SFixed::fromInternal(1);
118-
constexpr const static SFixed MinValue = SFixed::fromInternal(FIXED_POINTS_DETAILS::MsbMask<InternalSize>::Value);
119-
constexpr const static SFixed MaxValue = SFixed::fromInternal(~FIXED_POINTS_DETAILS::MsbMask<InternalSize>::Value);
117+
constexpr static SFixed Epsilon = SFixed::fromInternal(1);
118+
constexpr static SFixed MinValue = SFixed::fromInternal(FIXED_POINTS_DETAILS::MsbMask<InternalSize>::Value);
119+
constexpr static SFixed MaxValue = SFixed::fromInternal(~FIXED_POINTS_DETAILS::MsbMask<InternalSize>::Value);
120120

121121
// 40 digits is probably enough for these
122-
constexpr const static SFixed Pi = 3.1415926535897932384626433832795028841971;
123-
constexpr const static SFixed E = 2.718281828459045235360287471352662497757;
124-
constexpr const static SFixed Phi = 1.6180339887498948482045868343656381177203;
125-
constexpr const static SFixed Tau = 6.2831853071795864769252867665590057683943;
122+
constexpr static SFixed Pi = 3.1415926535897932384626433832795028841971;
123+
constexpr static SFixed E = 2.718281828459045235360287471352662497757;
124+
constexpr static SFixed Phi = 1.6180339887498948482045868343656381177203;
125+
constexpr static SFixed Tau = 6.2831853071795864769252867665590057683943;
126126
};
127127

128128

src/FixedPoints/UFixed.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ template< unsigned Integer, unsigned Fraction >
2626
class UFixed
2727
{
2828
public:
29-
constexpr const static uintmax_t IntegerSize = Integer;
30-
constexpr const static uintmax_t FractionSize = Fraction;
31-
constexpr const static uintmax_t LogicalSize = IntegerSize + FractionSize;
32-
constexpr const static uintmax_t Scale = UINTMAX_C(1) << FractionSize;
29+
constexpr static uintmax_t IntegerSize = Integer;
30+
constexpr static uintmax_t FractionSize = Fraction;
31+
constexpr static uintmax_t LogicalSize = IntegerSize + FractionSize;
32+
constexpr static uintmax_t Scale = UINTMAX_C(1) << FractionSize;
3333

3434
public:
3535
static_assert(LogicalSize <= FIXED_POINTS_DETAILS::BitSize<uintmax_t>::Value, "Platform does not have a native type large enough for UFixed.");
@@ -39,22 +39,22 @@ class UFixed
3939
using FractionType = FIXED_POINTS_DETAILS::LeastUInt<FractionSize>;
4040
using InternalType = FIXED_POINTS_DETAILS::LeastUInt<LogicalSize>;
4141

42-
constexpr const static uintmax_t InternalSize = FIXED_POINTS_DETAILS::BitSize<InternalType>::Value;
42+
constexpr static uintmax_t InternalSize = FIXED_POINTS_DETAILS::BitSize<InternalType>::Value;
4343

4444
using ShiftType = FIXED_POINTS_DETAILS::LeastUInt<LogicalSize>;
4545
using MaskType = FIXED_POINTS_DETAILS::LeastUInt<LogicalSize>;
4646

4747
public:
48-
constexpr const static ShiftType IntegerShift = FractionSize;
49-
constexpr const static ShiftType FractionShift = 0;
48+
constexpr static ShiftType IntegerShift = FractionSize;
49+
constexpr static ShiftType FractionShift = 0;
5050

51-
constexpr const static MaskType IntegerMask = FIXED_POINTS_DETAILS::IdentityMask<IntegerSize>::Value;
52-
constexpr const static MaskType FractionMask = FIXED_POINTS_DETAILS::IdentityMask<FractionSize>::Value;
51+
constexpr static MaskType IntegerMask = FIXED_POINTS_DETAILS::IdentityMask<IntegerSize>::Value;
52+
constexpr static MaskType FractionMask = FIXED_POINTS_DETAILS::IdentityMask<FractionSize>::Value;
5353

54-
constexpr const static MaskType IdentityMask = (IntegerMask << IntegerShift) | (FractionMask << FractionShift);
54+
constexpr static MaskType IdentityMask = (IntegerMask << IntegerShift) | (FractionMask << FractionShift);
5555

56-
constexpr const static MaskType MidpointMask = FIXED_POINTS_DETAILS::MsbMask<FractionSize>::Value;
57-
constexpr const static MaskType LesserMidpointMask = MidpointMask - 1;
56+
constexpr static MaskType MidpointMask = FIXED_POINTS_DETAILS::MsbMask<FractionSize>::Value;
57+
constexpr static MaskType LesserMidpointMask = MidpointMask - 1;
5858

5959
protected:
6060
class RawType
@@ -114,15 +114,15 @@ class UFixed
114114
UFixed & operator /=(const UFixed & other);
115115

116116
public:
117-
constexpr const static UFixed Epsilon = UFixed::fromInternal(1);
118-
constexpr const static UFixed MinValue = UFixed::fromInternal(0);
119-
constexpr const static UFixed MaxValue = UFixed::fromInternal(~0);
117+
constexpr static UFixed Epsilon = UFixed::fromInternal(1);
118+
constexpr static UFixed MinValue = UFixed::fromInternal(0);
119+
constexpr static UFixed MaxValue = UFixed::fromInternal(~0);
120120

121121
// 40 digits is probably enough for these
122-
constexpr const static UFixed Pi = 3.1415926535897932384626433832795028841971;
123-
constexpr const static UFixed E = 2.718281828459045235360287471352662497757;
124-
constexpr const static UFixed Phi = 1.6180339887498948482045868343656381177203;
125-
constexpr const static UFixed Tau = 6.2831853071795864769252867665590057683943;
122+
constexpr static UFixed Pi = 3.1415926535897932384626433832795028841971;
123+
constexpr static UFixed E = 2.718281828459045235360287471352662497757;
124+
constexpr static UFixed Phi = 1.6180339887498948482045868343656381177203;
125+
constexpr static UFixed Tau = 6.2831853071795864769252867665590057683943;
126126
};
127127

128128

0 commit comments

Comments
 (0)