aboutsummaryrefslogtreecommitdiffstats
path: root/src/zsplit.c
blob: afb8a339833c8514094d03bfe53fdad889ea15dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* See LICENSE file for copyright and license details. */
#include "internals.h"


void
zsplit(z_t high, z_t low, z_t a, size_t delim)
{
	if (unlikely(zzero(a))) {
		/* This is for performance. */
		SET_SIGNUM(high, 0);
		SET_SIGNUM(low, 0);
		return;
	}

	if (unlikely(high == a)) {
		ztrunc(low, a, delim);
		zrsh(high, a, delim);
	} else {
		zrsh(high, a, delim);
		ztrunc(low, a, delim);
	}
}