diff --git a/Meter.c b/Meter.c index ab11d93b2..76b770c3c 100644 --- a/Meter.c +++ b/Meter.c @@ -494,16 +494,16 @@ static uint16_t GraphMeterMode_makeDetailsMask(const GraphColorComputeState* pre assert(blanksAtTopCell < 8); blanksAtEnd = (uint8_t)blanksAtTopCell; roundsUpInAscii = true; - } else if (prev->nCellsPainted == 0 || prev->topPoint <= prev->nCellsPainted) { + } else if (prev->nCellsPainted == 0 || prev->topPoint <= (double)(int)prev->nCellsPainted) { blanksAtEnd = (uint8_t)((1.0 - rem) * 8.0) % 8; - } else if (new->nCellsPainted > new->topPoint) { - assert(new->nCellsPainted - new->topPoint < 1.0); + } else if ((double)(int)new->nCellsPainted > new->topPoint) { + assert((int)new->nCellsPainted - new->topPoint < 1.0); // Unlike other conditions, this one rounds to nearest for visual reason. // In case of a tie, display the dot at lower position of the graph, // i.e. MSB of the "details" data. double fraction = (1.0 - rem) * 8.0; fraction -= (int)fraction; - double distance = (new->nCellsPainted - new->topPoint) * 8.0 + (1.0 - fraction) * 0.5; + double distance = ((double)(int)new->nCellsPainted - new->topPoint) * 8.0 + (1.0 - fraction) * 0.5; blanksAtEnd = (uint8_t)distance; // Tiebreaking direction that may be needed in the ASCII display mode.