Coding style change

This commit is contained in:
Nils O. Selåsdal
2012-12-05 18:53:58 +01:00
parent d9c8b2b48a
commit 16e1ac52ec
32 changed files with 236 additions and 234 deletions
+9 -9
View File
@@ -26,11 +26,11 @@ struct bitvec *bitvec_new(size_t nbits)
{
struct bitvec *v = malloc(sizeof *v);
if(v == NULL)
if (v == NULL)
return NULL;
v->vec_len = BITVEC_VEC_LEN(nbits);
v->vec = malloc(v->vec_len * sizeof(unsigned long));
if(v->vec == NULL) {
if (v->vec == NULL) {
free(v);
return NULL;
}
@@ -42,7 +42,7 @@ struct bitvec *bitvec_new(size_t nbits)
void bitvec_free(struct bitvec *v)
{
if(v) {
if (v) {
free(v->vec);
free(v);
}
@@ -70,7 +70,7 @@ void set_bit_s(struct bitvec *v,int b)
assert(b >= 0);
assert(v->vec_len > (size_t)idx);
if(likely(idx < v->vec_len))
if (likely(idx < v->vec_len))
v->vec[idx] |= 1UL << (bit_offset(b));
}
@@ -81,7 +81,7 @@ void clear_bit_s(struct bitvec *v,int b)
assert(b >= 0);
assert(v->vec_len > (size_t)idx);
if(likely(idx < v->vec_len))
if (likely(idx < v->vec_len))
v->vec[idx] &= ~(1UL << (bit_offset(b)));
}
@@ -92,7 +92,7 @@ int get_bit_s(const struct bitvec *v,int b)
assert(b >= 0);
assert(v->vec_len > (size_t)idx);
if(likely(idx < v->vec_len))
if (likely(idx < v->vec_len))
return !!(v->vec[idx] & (1UL << bit_offset(b)));
else
return 0;
@@ -102,12 +102,12 @@ void set_bits_from_array(struct bitvec *v,char *array,size_t array_len)
{
size_t i;
for(i = 0; i < array_len; i++) {
for (i = 0; i < array_len; i++) {
size_t idx = (size_t)bit_index(array_len);
if(unlikely(idx >= v->vec_len))
if (unlikely(idx >= v->vec_len))
break;
if(array[i])
if (array[i])
set_bit(v,i);
else
clear_bit(v,i);