[PATCH 1/2] lib/lcm.c: Ensure correct result whenever it fits

2014-12-09 Thread Rasmus Villemoes
Ensure that lcm(a,b) returns the mathematically correct result, provided it fits in an unsigned long. The current version returns garbage if a*b overflows, even if the final result would fit. Signed-off-by: Rasmus Villemoes --- lib/lcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) dif

Re: [PATCH 1/2] lib/lcm.c: Ensure correct result whenever it fits

2014-01-14 Thread Rasmus Villemoes
Rasmus Villemoes writes: Ping... > Ensure that lcm(a,b) returns the mathematically correct result, > provided it fits in an unsigned long. The current version returns > garbage if a*b overflows, even if the final result would fit. > > Signed-off-by: Rasmus Villemoes > --- > There are of course

[PATCH 1/2] lib/lcm.c: Ensure correct result whenever it fits

2013-12-17 Thread Rasmus Villemoes
Ensure that lcm(a,b) returns the mathematically correct result, provided it fits in an unsigned long. The current version returns garbage if a*b overflows, even if the final result would fit. Signed-off-by: Rasmus Villemoes --- There are of course still plenty of cases where the return value is w