forked from mirrors/linux
		
	lib/lcm.c: lcm(n,0)=lcm(0,n) is 0, not n
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>
This commit is contained in:
		
							parent
							
								
									74a5fef7cb
								
							
						
					
					
						commit
						69c953c85c
					
				
					 1 changed files with 2 additions and 4 deletions
				
			
		|  | @ -8,9 +8,7 @@ unsigned long lcm(unsigned long a, unsigned long b) | ||||||
| { | { | ||||||
| 	if (a && b) | 	if (a && b) | ||||||
| 		return (a / gcd(a, b)) * b; | 		return (a / gcd(a, b)) * b; | ||||||
| 	else if (b) | 	else | ||||||
| 		return b; | 		return 0; | ||||||
| 
 |  | ||||||
| 	return a; |  | ||||||
| } | } | ||||||
| EXPORT_SYMBOL_GPL(lcm); | EXPORT_SYMBOL_GPL(lcm); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Rasmus Villemoes
						Rasmus Villemoes