diff options
Diffstat (limited to 'lib/datastruct/bitset.c')
-rw-r--r-- | lib/datastruct/bitset.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/datastruct/bitset.c b/lib/datastruct/bitset.c index 44d69626..3d1a2875 100644 --- a/lib/datastruct/bitset.c +++ b/lib/datastruct/bitset.c @@ -12,7 +12,7 @@ /* FIXME: calculate this. */ #define INT_SHIFT 5 -bitset_t bitset_create(struct pool *mem, unsigned num_bits) +bitset_t bitset_create(struct pool * mem, unsigned num_bits) { int n = (num_bits / BITS_PER_INT) + 2; int size = sizeof(int) * n; @@ -33,7 +33,7 @@ void bitset_destroy(bitset_t bs) void bit_union(bitset_t out, bitset_t in1, bitset_t in2) { int i; - for(i = (in1[0] / BITS_PER_INT) + 1; i; i--) + for (i = (in1[0] / BITS_PER_INT) + 1; i; i--) out[i] = in1[i] | in2[i]; } @@ -58,7 +58,7 @@ int bit_get_next(bitset_t bs, int last_bit) last_bit++; /* otherwise we'll return the same bit again */ - while(last_bit < bs[0]) { + while (last_bit < bs[0]) { word = last_bit >> INT_SHIFT; test = bs[word + 1]; bit = last_bit & (BITS_PER_INT - 1); @@ -66,8 +66,8 @@ int bit_get_next(bitset_t bs, int last_bit) if ((bit = _test_word(test, bit)) >= 0) return (word * BITS_PER_INT) + bit; - last_bit = last_bit - (last_bit & (BITS_PER_INT - 1)) + - BITS_PER_INT; + last_bit = last_bit - (last_bit & (BITS_PER_INT - 1)) + + BITS_PER_INT; } return -1; |