MCPcopy Create free account
hub / github.com/celtera/libremidi / array_gcd

Function array_gcd

examples/midi_to_pattern.cpp:29–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27};
28
29static int64_t array_gcd(const auto& arr)
30{
31 if (arr.empty())
32 return 1;
33
34 auto it = arr.begin();
35 int64_t res = *it;
36 ++it;
37
38 for (; it != arr.end(); ++it)
39 if ((res = std::gcd(*it, res)) == 1)
40 break;
41
42 return res;
43}
44
45int main(int argc, char* argv[])
46{

Callers 1

mainFunction · 0.85

Calls 3

emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected