diff options
| author | Mattias Andrée <maandree@kth.se> | 2016-03-03 23:02:59 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2016-03-03 23:02:59 +0100 |
| commit | d6987458f21cf1890045f2606d0f8ec4d2225b44 (patch) | |
| tree | 90afabbea01b01c4dedcb41748eb534ce04fbf77 /src/zgcd.c | |
| parent | zsets: minor optimisation (diff) | |
| download | libzahl-d6987458f21cf1890045f2606d0f8ec4d2225b44.tar.gz libzahl-d6987458f21cf1890045f2606d0f8ec4d2225b44.tar.bz2 libzahl-d6987458f21cf1890045f2606d0f8ec4d2225b44.tar.xz | |
Cleanup and fix bug in ztrunc
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/zgcd.c')
| -rw-r--r-- | src/zgcd.c | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -17,18 +17,15 @@ zgcd(z_t a, z_t b, z_t c) int neg; if (!zcmp(b, c)) { - if (a != b) - zset(a, b); + SET(a, b); return; } if (zzero(b)) { - if (a != c) - zset(a, c); + SET(a, c); return; } if (zzero(c)) { - if (a != b) - zset(a, b); + SET(a, b); return; } @@ -36,7 +33,7 @@ zgcd(z_t a, z_t b, z_t c) zabs(v, c); neg = zsignum(b) < 0 && zsignum(c) < 0; - min = u->used < v->used ? u->used : v->used; + min = MIN(u->used, v->used); for (; i < min; i++) { uv = u->chars[i] | v->used[i]; for (bit = 1; bit; bit <<= 1, shifts++) |
