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


int
zbtest(z_t a, size_t bit)
{
	size_t chars;
	if (zzero(a))
		return 0;

	chars = FLOOR_BITS_TO_CHARS(bit);
	if (chars >= a->used)
		return 0;

	bit = BITS_IN_LAST_CHAR(bit);
	return (a->chars[chars] >> bit) & 1;
}