From 79ef8398f324b2b0e6841968dfe7b5867095a2c8 Mon Sep 17 00:00:00 2001 From: Pharap <2933055+Pharap@users.noreply.github.com> Date: Sun, 25 Sep 2022 10:37:25 +0100 Subject: [PATCH] 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. --- src/FixedPoints/Details.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FixedPoints/Details.h b/src/FixedPoints/Details.h index a2a81fe..26e03b0 100644 --- a/src/FixedPoints/Details.h +++ b/src/FixedPoints/Details.h @@ -126,7 +126,7 @@ namespace FIXED_POINTS_DETAILS struct IdentityMask { IdentityMask() = delete; - static constexpr LeastUInt Value = 1 | (IdentityMask::Value << 1); + static constexpr LeastUInt Value = 1 | (static_cast>(IdentityMask::Value) << 1); }; template<>