aboutsummaryrefslogtreecommitdiffstats
path: root/src/zbtest.c
blob: a97e7149363352b2fd51a449382081b59ada84af (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.h"


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;
}