diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index ee3e69852..657847728 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.47 - ================================= + Add dm_bit_and. Simplify dm_bitset_create. Speed up dm_bit_get_next with ffs(). diff --git a/libdm/datastruct/bitset.c b/libdm/datastruct/bitset.c index bb16adda6..6dd5952a6 100644 --- a/libdm/datastruct/bitset.c +++ b/libdm/datastruct/bitset.c @@ -42,6 +42,13 @@ void dm_bitset_destroy(dm_bitset_t bs) dm_free(bs); } +void dm_bit_and(dm_bitset_t out, dm_bitset_t in1, dm_bitset_t in2) +{ + int i; + + for (i = (in1[0] / DM_BITS_PER_INT) + 1; i; i--) + out[i] = in1[i] & in2[i]; +} void dm_bit_union(dm_bitset_t out, dm_bitset_t in1, dm_bitset_t in2) { int i;