17 const Buffer<T> buffer(
const_cast<T*
>(data), dataSize);
27 size_t sumHighLast = 0;
28 size_t nValuesSummed = 0;
30 if (data.
data() ==
nullptr)
36 for (
size_t i = 0; i < data.
count(); i++)
39 if (sumLowLast > sumLow)
44 if (sumHighLast > sumHigh)
47 sumHigh = sumHighLast;
52 sumHighLast = sumHigh;
56 return divide(sumHigh, sumLow, nValuesSummed);
62 uint32_t binPlacesDivider = 0;
64 size_t divideHelper = 0;
68 for (uint32_t i = 0; i < static_cast<uint32_t>(
sizeof(divider)) * 8; i++)
77 for (uint32_t i = 0; i < binPlacesDivider; i++)
83 divideHelper = highValue >>
static_cast<T
>(((
sizeof(std::size_t) * 8) - binPlacesDivider) & mask);
86 for (
int i = ((
sizeof(T) +
sizeof(std::size_t)) * 8) - binPlacesDivider; i >= 0; i--)
89 if (divideHelper >= divider)
92 divideHelper = divideHelper - divider;
94 divideHelper = divideHelper << 1;
96 if (i >
static_cast<int>(
sizeof(T)) * 8)
97 divideHelper = divideHelper +
static_cast<T
>((highValue >> (i - (
sizeof(T) * 8) - 1)) & 1);
99 divideHelper = divideHelper +
static_cast<T
>((lowValue >> (i - 1)) & 1);
Average calculates the average value of the entries of a given Buffer or an data array....
static T value(const T data[], size_t dataSize)
Calculates an average out of an array.
Buffer is a base class for buffer implementations.
T * data() const
Returns the pointer to the first element of the data array.
virtual size_t count() const
Returns the number of entries stored in the buffer.