aboutsummaryrefslogtreecommitdiffstats
path: root/src/zbtest.c
blob: 8e9f8ff3a62dd417e78129bd7c8d263871d82c3e (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 = bit >> LB_BITS_PER_CHAR;
	if (chars >= a->used)
		return 0;

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