From f5794f1128032ab1e69120052fd855f9e4b13e36 Mon Sep 17 00:00:00 2001 From: fwcd Date: Wed, 10 Apr 2019 00:03:10 +0200 Subject: [PATCH] Default-initialize number mantissa to zero --- src/CalcManager/Ratpack/conv.cpp | 2 +- src/CalcManager/Ratpack/ratpak.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CalcManager/Ratpack/conv.cpp b/src/CalcManager/Ratpack/conv.cpp index 2ae5f5c3..8de52a6e 100644 --- a/src/CalcManager/Ratpack/conv.cpp +++ b/src/CalcManager/Ratpack/conv.cpp @@ -185,7 +185,7 @@ NUMBER _createnum( _In_ uint32_t size ) { NUMBER num = NUMBER(); // Fill mantissa vector with zeros - num.mant.insert(num.mant.end(), size, 0); + num.mant.insert(num.mant.end(), size - 1, 0); return( num ); } diff --git a/src/CalcManager/Ratpack/ratpak.h b/src/CalcManager/Ratpack/ratpak.h index 00095c36..d749140a 100644 --- a/src/CalcManager/Ratpack/ratpak.h +++ b/src/CalcManager/Ratpack/ratpak.h @@ -61,7 +61,7 @@ typedef struct _number // radix being used. int32_t exp; // The offset of digits from the radix point // (decimal point in radix 10) - std::vector mant; + std::vector mant = {0}; } NUMBER;