From 38de324e6db933249a421b9607481c1db66741fa Mon Sep 17 00:00:00 2001 From: Fabian Meyer Date: Mon, 11 Nov 2024 18:17:03 +0100 Subject: [PATCH] Fix incorrect encodedLength for -0.0 Signed-off-by: Fabian Meyer --- libember/Headers/ember/ber/traits/Real.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libember/Headers/ember/ber/traits/Real.hpp b/libember/Headers/ember/ber/traits/Real.hpp index c6530b0..f5a694a 100644 --- a/libember/Headers/ember/ber/traits/Real.hpp +++ b/libember/Headers/ember/ber/traits/Real.hpp @@ -102,10 +102,11 @@ namespace libember { namespace ber static std::size_t encodedLength(value_type value) { - if (value == +std::numeric_limits::infinity() - || value == -std::numeric_limits::infinity() - || value == std::numeric_limits::quiet_NaN() - || value == std::numeric_limits::signaling_NaN()) + if ((value == +std::numeric_limits::infinity()) + || (value == -std::numeric_limits::infinity()) + || (value == std::numeric_limits::quiet_NaN()) + || (value == std::numeric_limits::signaling_NaN()) + || ((value == static_cast(0.0)) && util::signbit(value))) { return 1; }