Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/include/adt/gcdlcm.h

    r283bb9f rad9178bf  
    4242        static inline type name(type a, type b) \
    4343        { \
     44                if (a == 0) \
     45                        return b; \
     46                 \
    4447                while (b != 0) { \
    45                         type remainder = a % b; \
    46                         a = b; \
    47                         b = remainder; \
     48                        if (a > b) \
     49                                a -= b; \
     50                        else \
     51                                b -= a; \
    4852                } \
    4953                 \
     
    5458        static inline type name(type a, type b) \
    5559        { \
    56                 return (a / gcd(a, b)) * b; \
     60                return (a * b) / gcd(a, b); \
    5761        }
    5862
Note: See TracChangeset for help on using the changeset viewer.