mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-07 16:06:25 +00:00
overlay: Negative modulus
Don't use a negative index into the array if the desired element is negative, just wrap around properly into the ring for the chart. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
c537cdb08e
commit
7f9d14aa51
@ -143,7 +143,11 @@ static double value_at(struct chart *chart, int n)
|
||||
else if (n >= chart->current_sample)
|
||||
n = chart->current_sample - 1;
|
||||
|
||||
return chart->samples[n % chart->num_samples];
|
||||
n %= chart->num_samples;
|
||||
if (n < 0)
|
||||
n += chart->num_samples;
|
||||
|
||||
return chart->samples[n];
|
||||
}
|
||||
|
||||
static double gradient_at(struct chart *chart, int n)
|
||||
|
Loading…
x
Reference in New Issue
Block a user