diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-12-08 14:28:26 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-12-08 14:28:26 -0500 |
| commit | d65a0abba13a041fa07851b4db222336fab1d954 (patch) | |
| tree | 9428ce401d10181cc45e4176c9e6077d8bf43dca /stdlib/integers.h | |
| parent | 841c8114a3defdef74042e0f92930debe9ff93fc (diff) | |
Add GCD function for integers (of all flavors)
Diffstat (limited to 'stdlib/integers.h')
| -rw-r--r-- | stdlib/integers.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/stdlib/integers.h b/stdlib/integers.h index 52e04418..20457556 100644 --- a/stdlib/integers.h +++ b/stdlib/integers.h @@ -39,6 +39,7 @@ MACROLIKE PUREFUNC c_type type_name ## $clamped(c_type x, c_type min, c_type max) { \ return x < min ? min : (x > max ? max : x); \ } \ + CONSTFUNC c_type type_name ## $gcd(c_type x, c_type y); \ extern const c_type type_name ## $min, type_name##$max; \ extern const TypeInfo_t type_name ## $info; \ MACROLIKE c_type type_name ## $divided_by(c_type D, c_type d) { \ @@ -105,6 +106,7 @@ OptionalInt_t Int$from_str(const char *str); OptionalInt_t Int$parse(Text_t text); Int_t Int$abs(Int_t x); Int_t Int$power(Int_t base, Int_t exponent); +Int_t Int$gcd(Int_t x, Int_t y); OptionalInt_t Int$sqrt(Int_t i); #define BIGGEST_SMALL_INT ((1<<29)-1) |
