From 59ea642571eb253ba1f95e916dd0bb82dd0f7824 Mon Sep 17 00:00:00 2001 From: Pharap <2933055+Pharap@users.noreply.github.com> Date: Sun, 25 Sep 2022 10:35:47 +0100 Subject: [PATCH] Fix bug in IdentityMask calculation 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<>