From a6695a0bf73ac137d141731db53597cb2dbeef1d Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Sun, 22 Nov 2015 11:33:58 -0500 Subject: [PATCH] Fixed a precision bug that caused signed 32 bit integers to not work properly. --- graphingwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphingwindow.cpp b/graphingwindow.cpp index 5712824..cc33d57 100644 --- a/graphingwindow.cpp +++ b/graphingwindow.cpp @@ -960,7 +960,7 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam) float tempValue; int64_t tempValInt; int numBytes = (params.endByte - params.startByte) + 1; - int64_t shiftRef = 1 << (numBytes * 8); + int64_t shiftRef = (uint64_t)1 << (numBytes * 8); uint64_t maskShifter; uint8_t tempByte; for (int j = 0; j < numEntries; j++) @@ -1010,7 +1010,7 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam) float tempValue; int64_t tempValInt; int numBytes = (params.startByte - params.endByte) + 1; - int64_t shiftRef = 1 << (numBytes * 8); + int64_t shiftRef = (uint64_t)1 << (numBytes * 8); uint64_t maskShifter; uint8_t tempByte; for (int j = 0; j < numEntries; j++)