Skip to content

Commit 79ef839

Browse files
authored
Fix bug in IdentityMask calculation (#99)
The bit width of the type was not being sufficiently increased, which was leading to dropped bits, which in turn caused problems with floating point conversion and possibly other problems.
1 parent 5411bf0 commit 79ef839

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/FixedPoints/Details.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ namespace FIXED_POINTS_DETAILS
126126
struct IdentityMask
127127
{
128128
IdentityMask() = delete;
129-
static constexpr LeastUInt<Bits> Value = 1 | (IdentityMask<Bits - 1>::Value << 1);
129+
static constexpr LeastUInt<Bits> Value = 1 | (static_cast<LeastUInt<Bits>>(IdentityMask<Bits - 1>::Value) << 1);
130130
};
131131

132132
template<>

0 commit comments

Comments
 (0)