blob: 5b13b7ab75184d371cfaa0d36422b025422a8759 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
/* ISC license. */
#include <sys/types.h>
#include <skalibs/bitarray.h>
int bitarray_testandpoke (register unsigned char *s, register size_t n, register int h)
{
register unsigned char mask = 1 << (n & 7) ;
register unsigned char c = s[n>>3] ;
s[n>>3] = h ? c | mask : c & ~mask ;
return (c & mask) ? 1 : 0 ;
}
|