Update tests for new check library & osx

This commit is contained in:
Nils O. Selåsdal
2025-06-28 00:56:58 +02:00
parent 9d2ed015f3
commit fb8979d695
29 changed files with 449 additions and 27 deletions
+11 -13
View File
@@ -18,22 +18,21 @@ static inline int bit_index(int b)
}
static inline int bit_offset(int b)
{
{
return b % (sizeof(uc_bv_integer) * CHAR_BIT);
}
struct UCBitVec *uc_bv_new(size_t nbits)
{
struct UCBitVec *v = malloc(sizeof *v);
size_t vec_len = UC_BV_LEN(nbits);
struct UCBitVec *v;
void *mem = malloc(sizeof *v + vec_len * sizeof(uc_bv_integer));
v = mem;
if (v == NULL)
return NULL;
v->vec_len = UC_BV_LEN(nbits);
v->vec = malloc(v->vec_len * sizeof(uc_bv_integer));
if (v->vec == NULL) {
free(v);
return NULL;
}
v->vec_len = vec_len;
v->vec = mem + sizeof *v;
uc_bv_clr_all(v);
@@ -43,24 +42,23 @@ struct UCBitVec *uc_bv_new(size_t nbits)
void uc_bv_free(struct UCBitVec *v)
{
if (v) {
free(v->vec);
free(v);
}
}
void uc_bv_clr_bit(struct UCBitVec *v,int b)
{
{
v->vec[bit_index(b)] &= ~(1UL << (bit_offset(b)));
}
int uc_bv_get_bit(const struct UCBitVec *v,int b)
{
{
return !!(v->vec[bit_index(b)] & (1UL << bit_offset(b)));
}
void uc_bv_set_bit(struct UCBitVec *v,int b)
{
v->vec[bit_index(b)] |= 1UL << (bit_offset(b));
{
v->vec[bit_index(b)] |= 1UL << (bit_offset(b));
}
void uc_bv_set_bits_from_array(struct UCBitVec *v,const char *array,size_t array_len)