Skip to content

Commit

Permalink
Fix incorrect encodedLength for -0.0
Browse files Browse the repository at this point in the history
Signed-off-by: Fabian Meyer <[email protected]>
  • Loading branch information
Fabian Meyer authored and KimonHoffmann committed Nov 12, 2024
1 parent e6d97fd commit 38de324
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions libember/Headers/ember/ber/traits/Real.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ namespace libember { namespace ber

static std::size_t encodedLength(value_type value)
{
if (value == +std::numeric_limits<value_type>::infinity()
|| value == -std::numeric_limits<value_type>::infinity()
|| value == std::numeric_limits<value_type>::quiet_NaN()
|| value == std::numeric_limits<value_type>::signaling_NaN())
if ((value == +std::numeric_limits<value_type>::infinity())
|| (value == -std::numeric_limits<value_type>::infinity())
|| (value == std::numeric_limits<value_type>::quiet_NaN())
|| (value == std::numeric_limits<value_type>::signaling_NaN())
|| ((value == static_cast<value_type>(0.0)) && util::signbit(value)))
{
return 1;
}
Expand Down

0 comments on commit 38de324

Please sign in to comment.