I need the functionality of the std::accumulate function from the C++ "numeric" library but I am working in C
. I still have a rudimentary understanding of the differences in the c/c++ compilers, so I don't know if it's possible to implement this feature in a c file. I am hoping for a similar, fast and effective way to sum the items in a buffer, because I am writing a DMA buffer (I will be reading ADC values in), and need to pull the sum of a buffer when it fills up and calls the callback for the interrupt.
Basically I need a C function to return the sum of everything from Buffer to Buffer + BufferLength.
Thanks!