projects
/
icmpmonitor
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a08c085
)
Clearer GCD function in icmpmonitor.c.
author
Aaron Taylor
<ataylor@subgeniuskitty.com>
Sat, 21 Sep 2019 07:41:38 +0000
(
00:41
-0700)
committer
Aaron Taylor
<ataylor@subgeniuskitty.com>
Sat, 21 Sep 2019 07:41:38 +0000
(
00:41
-0700)
icmpmonitor.c
patch
|
blob
|
blame
|
history
diff --git
a/icmpmonitor.c
b/icmpmonitor.c
index
42b1b3a
..
f0fbc09
100644
(file)
--- a/
icmpmonitor.c
+++ b/
icmpmonitor.c
@@
-591,12
+591,7
@@
static void log(int type, char *format, ...)
static int gcd(int x, int y)
{
static int gcd(int x, int y)
{
- while(x!=y)
- {
- if(x<y)
- y-=x;
- else
- x-=y;
- }
- return x;
+ int remainder = x % y;
+ if (remainder == 0) return y;
+ return gcd(y, remainder);
}
}