MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / gcd

Function gcd

rate_limiter/src/lib.rs:78–87  ·  view source on GitHub ↗

Euclid's two-thousand-year-old algorithm for finding the greatest common divisor.

(x: u64, y: u64)

Source from the content-addressed store, hash-verified

76
77// Euclid's two-thousand-year-old algorithm for finding the greatest common divisor.
78fn gcd(x: u64, y: u64) -> u64 {
79 let mut x = x;
80 let mut y = y;
81 while y != 0 {
82 let t = y;
83 y = x % y;
84 x = t;
85 }
86 x
87}
88
89/// Enum describing the outcomes of a `reduce()` call on a `TokenBucket`.
90#[derive(Clone, Debug, PartialEq)]

Callers 1

newMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected