MCPcopy Create free account
hub / github.com/ElementsProject/elements / cumulative

Function cumulative

src/simplicity/rsort.c:55–61  ·  view source on GitHub ↗

Given an array of bucket sizes, and an initial value 'bucketEdge[0]', * add subsequent bucket edges of the given bucket sizes. * * Precondition: uint32_t bucketEdge[CHAR_COUNT]; * const uint32_t sizes[CHAR_COUNT]; */

Source from the content-addressed store, hash-verified

53 * const uint32_t sizes[CHAR_COUNT];
54 */
55static void cumulative(uint32_t* restrict bucketEdge, const uint32_t* restrict sizes) {
56 uint32_t accumulator = bucketEdge[0] + sizes[0];
57 for (unsigned int i = 1; i < CHAR_COUNT; ++i) {
58 bucketEdge[i] = accumulator;
59 accumulator += sizes[i];
60 }
61}
62
63/* Exchange two pointers.
64 * (a == b is acceptable.)

Callers 1

rsort_exFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected