MCPcopy Create free account
hub / github.com/F-Stack/f-stack / get_gcd

Function get_gcd

dpdk/lib/mempool/rte_mempool.c:59–81  ·  view source on GitHub ↗

* return the greatest common divisor between a and b (fast algorithm) */

Source from the content-addressed store, hash-verified

57 * return the greatest common divisor between a and b (fast algorithm)
58 */
59static unsigned get_gcd(unsigned a, unsigned b)
60{
61 unsigned c;
62
63 if (0 == a)
64 return b;
65 if (0 == b)
66 return a;
67
68 if (a < b) {
69 c = a;
70 a = b;
71 b = c;
72 }
73
74 while (b != 0) {
75 c = a % b;
76 a = b;
77 b = c;
78 }
79
80 return a;
81}
82
83/*
84 * Depending on memory configuration on x86 arch, objects addresses are spread

Callers 1

arch_mem_object_alignFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected