Skip to content

Commit

Permalink
findTopCellItem() optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Explorer09 committed Feb 6, 2024
1 parent 0248930 commit 2480632
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ static uint8_t GraphMeterMode_findTopCellItem(const Meter* this, double scaledTo
double topPoint = (valueSum / scaledTotal) * (double)(int)graphHeight;
double area = (value / scaledTotal) * (double)(int)graphHeight;

if (topPoint - (double)(int)topCell > 0.0 || (topPoint <= 0.0 && topCell < 1)) {
if (topPoint > (double)(int)topCell || (topPoint <= 0.0 && topCell < 1)) {
// If the division underflows (topPoint <= 0.0 && topCell < 1), that
// item still counts as part of the top cell ("area" would be 0.0 in
// this case).
Expand Down

0 comments on commit 2480632

Please sign in to comment.