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:
Jared Boone 2015-11-11 09:30:15 -08:00
parent ebf103363c
commit d02698a6de

View File

@ -37,6 +37,12 @@ public:
return; return;
} }
if( statistics.count == 0 ) {
const auto value_0 = *p;
statistics.min = value_0;
statistics.max = value_0;
}
const auto end = &p[buffer.count]; const auto end = &p[buffer.count];
while(p < end) { while(p < end) {
const uint32_t value = *(p++); const uint32_t value = *(p++);
@ -58,9 +64,6 @@ public:
callback(statistics); callback(statistics);
statistics.accumulator = 0; statistics.accumulator = 0;
statistics.count = 0; statistics.count = 0;
const auto value_0 = *p;
statistics.min = value_0;
statistics.max = value_0;
} }
} }