diff options
Diffstat (limited to '')
-rw-r--r-- | sql/sql_bitmap.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h index 353601eb..05b201a5 100644 --- a/sql/sql_bitmap.h +++ b/sql/sql_bitmap.h @@ -270,13 +270,21 @@ public: { return buffer[0]; } - uint bits_set() + uint bits_set() const { uint res= 0; for (size_t i= 0; i < ARRAY_ELEMENTS; i++) - res += my_count_bits(buffer[i]); + if (buffer[i]) + res+= my_count_bits(buffer[i]); return res; } + uint find_first_bit() const + { + for (size_t i= 0; i < ARRAY_ELEMENTS; i++) + if (buffer[i]) + return (uint)i*BITS_PER_ELEMENT + my_find_first_bit(buffer[i]); + return width; + } class Iterator { const Bitmap& map; |