mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-13 03:34:35 +00:00
Apparent bug where min/max aren't initialized from value inside the buffer bounds.
The fix is less than ideal, it assumes that an incoming buffer length is always >= 1.
This commit is contained in:
parent
ebf103363c
commit
d02698a6de
@ -37,6 +37,12 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if( statistics.count == 0 ) {
|
||||
const auto value_0 = *p;
|
||||
statistics.min = value_0;
|
||||
statistics.max = value_0;
|
||||
}
|
||||
|
||||
const auto end = &p[buffer.count];
|
||||
while(p < end) {
|
||||
const uint32_t value = *(p++);
|
||||
@ -58,9 +64,6 @@ public:
|
||||
callback(statistics);
|
||||
statistics.accumulator = 0;
|
||||
statistics.count = 0;
|
||||
const auto value_0 = *p;
|
||||
statistics.min = value_0;
|
||||
statistics.max = value_0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user