aboutsummaryrefslogtreecommitdiffstats
path: root/src/zsplit.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-03-05 20:16:14 +0100
committerMattias Andrée <maandree@kth.se>2016-03-05 20:16:14 +0100
commit5860237d2f05f6ae45a98569b0d567c2227904c6 (patch)
treebbddb91e2a6a5e7efe7825971c726a9e4db87dd6 /src/zsplit.c
parentMore detailed description of division and modulus (diff)
downloadlibzahl-5860237d2f05f6ae45a98569b0d567c2227904c6.tar.gz
libzahl-5860237d2f05f6ae45a98569b0d567c2227904c6.tar.bz2
libzahl-5860237d2f05f6ae45a98569b0d567c2227904c6.tar.xz
Fix bugs and add a randomised testing
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/zsplit.c')
-rw-r--r--src/zsplit.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/zsplit.c b/src/zsplit.c
index 384c5d7..8f51721 100644
--- a/src/zsplit.c
+++ b/src/zsplit.c
@@ -5,27 +5,17 @@
void
zsplit(z_t high, z_t low, z_t a, size_t delim)
{
- size_t chars;
-
if (zzero(a)) {
SET_SIGNUM(high, 0);
SET_SIGNUM(low, 0);
return;
}
- chars = FLOOR_BITS_TO_CHARS(delim);
-
if (high == a) {
- if (a->used < chars)
- SET_SIGNUM(low, 0);
- else
- ztrunc(low, a, delim);
+ ztrunc(low, a, delim);
zrsh(high, a, delim);
} else {
zrsh(high, a, delim);
- if (a->used < chars)
- SET_SIGNUM(low, 0);
- else
- ztrunc(low, a, delim);
+ ztrunc(low, a, delim);
}
}