| 218 | // Returns the greatest common divisor of a and b |
| 219 | template<typename Int> |
| 220 | oidn_host_device_inline Int gcd(Int a, Int b) |
| 221 | { |
| 222 | while (b != 0) |
| 223 | { |
| 224 | const Int t = b; |
| 225 | b = a % b; |
| 226 | a = t; |
| 227 | } |
| 228 | return a; |
| 229 | } |
| 230 | |
| 231 | // Returns the least common multiple of a and b |
| 232 | template<typename Int> |