MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / reflect_index

Function reflect_index

src/framework/audio/chunking.cpp:21–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 throw std::runtime_error(std::string("Audio chunker requires positive ") + name);
20 }
21}
22
23int64_t reflect_index(int64_t index, int64_t length) {
24 require_positive(length, "reflect length");
25 if (length == 1) {
26 return 0;
27 }
28 while (index < 0 || index >= length) {
29 if (index < 0) {
30 index = -index;
31 } else {
32 index = 2 * length - index - 2;
33 }
34 }
35 return index;
36}
37

Callers 2

copy_planar_chunkFunction · 0.70

Calls 1

require_positiveFunction · 0.70

Tested by

no test coverage detected