#include <linux/kernel.h> #include <linux/gcd.h> #include <linux/export.h> /* * This implements the binary GCD algorithm. (Often attributed to Stein, * but as Knuth has noted, appears in a first-century Chinese math text.) * * This is faster than the division-based algorithm even on x86, which * has decent hardware division. */ #if !defined(CONFIG_CPU_NO_EFFICIENT_FFS) && !defined(CPU_NO_EFFICIENT_FFS) /* If __ffs is available, the even/odd algorithm benchmarks slower. */
unsigned long gcd(unsigned long a, unsigned long b) { unsigned long r = a | b; if (!a || !b) return r; b >>= __ffs(b); if (b == 1) return r & -r; for (;;) { a >>= __ffs(a); if (a == 1) return r & -r; if (a == b) return a << __ffs(r); if (a < b) swap(a, b); a -= b; } }Contributors
Person | Tokens | Prop | Commits | CommitProp | |
zeng zhaoxiu | zeng zhaoxiu | 79 | 72.48% | 1 | 50.00% |
florian fainelli | florian fainelli | 30 | 27.52% | 1 | 50.00% |
Total | 109 | 100.00% | 2 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp | |
zeng zhaoxiu | zeng zhaoxiu | 112 | 83.58% | 1 | 33.33% |
florian fainelli | florian fainelli | 15 | 11.19% | 1 | 33.33% |
davidlohr bueso | davidlohr bueso | 7 | 5.22% | 1 | 33.33% |
Total | 134 | 100.00% | 3 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp | |
zeng zhaoxiu | zeng zhaoxiu | 211 | 76.17% | 1 | 25.00% |
florian fainelli | florian fainelli | 58 | 20.94% | 1 | 25.00% |
davidlohr bueso | davidlohr bueso | 7 | 2.53% | 1 | 25.00% |
paul gortmaker | paul gortmaker | 1 | 0.36% | 1 | 25.00% |
Total | 277 | 100.00% | 4 | 100.00% |