projects
/
GitHub
/
LineageOS
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
74a5fef
)
lib/lcm.c: lcm(n,0)=lcm(0,n) is 0, not n
author
Rasmus Villemoes
<linux@rasmusvillemoes.dk>
Wed, 10 Dec 2014 23:51:29 +0000
(15:51 -0800)
committer
Linus Torvalds
<torvalds@linux-foundation.org>
Thu, 11 Dec 2014 01:41:11 +0000
(17:41 -0800)
Return the mathematically correct answer when an argument is 0.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/lcm.c
patch
|
blob
|
blame
|
history
diff --git
a/lib/lcm.c
b/lib/lcm.c
index 01b3aa922dda39ee1eec7e37e285c1d1339ce910..51cc6b13cd52d3fb94bc15294a67a20e8df84db1 100644
(file)
--- a/
lib/lcm.c
+++ b/
lib/lcm.c
@@
-8,9
+8,7
@@
unsigned long lcm(unsigned long a, unsigned long b)
{
if (a && b)
return (a / gcd(a, b)) * b;
- else if (b)
- return b;
-
- return a;
+ else
+ return 0;
}
EXPORT_SYMBOL_GPL(lcm);