Skip to content

Commit

Permalink
valueCellIndex() set "increment" code order
Browse files Browse the repository at this point in the history
  • Loading branch information
Explorer09 committed Feb 1, 2024
1 parent adb0936 commit 6a58f17
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,14 @@ static void GraphMeterMode_reallocateGraphBuffer(Meter* this, const GraphDrawCon
static unsigned int GraphMeterMode_valueCellIndex(unsigned int graphHeight, bool isPercentChart, int deltaExp, unsigned int y, unsigned int* scaleFactor, unsigned int* increment) {
if (scaleFactor)
*scaleFactor = 1;
if (increment)
*increment = isPercentChart ? 1 : (2U << deltaExp);

assert(deltaExp >= 0);
assert(deltaExp < UINT16_WIDTH);
unsigned int yTop = (graphHeight - 1) >> deltaExp;
if (isPercentChart) {
assert(deltaExp == 0);
if (increment)
*increment = 1;

if (y > yTop)
return (unsigned int)-1;
Expand All @@ -354,9 +354,6 @@ static unsigned int GraphMeterMode_valueCellIndex(unsigned int graphHeight, bool
// [5] [10] X X X | computed from cells of a
// [3] [6] (12) X X | lower scale and not stored in
// [1] [2] [4] [8] (16) | the array.
if (increment)
*increment = 2U << deltaExp;

if (y > yTop)
return (unsigned int)-1;

Expand Down

0 comments on commit 6a58f17

Please sign in to comment.