summaryrefslogtreecommitdiff
path: root/sql/sql_bitmap.h
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-05-16 22:39:43 -0700
committerIgor Babaev <igor@askmonty.org>2011-05-16 22:39:43 -0700
commit704f97035fed1a454ea3300d2ad5dda906dbce50 (patch)
tree7204d0246b026782b99b8effe9a0ec682e90e209 /sql/sql_bitmap.h
parent7b797fe66d7167a8f5cbb071a06a640a627f2186 (diff)
parenta8be09a9f26b43139ad84ead314898d23394f673 (diff)
downloadmariadb-git-704f97035fed1a454ea3300d2ad5dda906dbce50.tar.gz
Merged the code of MWL#106 into 5.3
Resolved all conflicts, bad merges and fixed a few minor bugs in the code. Commented out the queries from multi_update, view, subselect_sj, func_str, derived_view, view_grant that failed either with crashes in ps-protocol or with wrong results. The failures are clear indications of some bugs in the code and these bugs are to be fixed.
Diffstat (limited to 'sql/sql_bitmap.h')
-rw-r--r--sql/sql_bitmap.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h
index 5385acc934f..25725ff6c42 100644
--- a/sql/sql_bitmap.h
+++ b/sql/sql_bitmap.h
@@ -91,6 +91,10 @@ public:
DBUG_ASSERT(sizeof(buffer) >= 4);
return (ulonglong) uint4korr(buffer);
}
+ uint bits_set()
+ {
+ return bitmap_bits_set(&map);
+ }
};
/* An iterator to quickly walk over bits in unlonglong bitmap. */
@@ -169,5 +173,16 @@ public:
public:
Iterator(Bitmap<64> &bmp) : Table_map_iterator(bmp.map) {}
};
+ uint bits_set()
+ {
+ //TODO: use my_count_bits()
+ uint res= 0, i= 0;
+ for (; i < 64 ; i++)
+ {
+ if (map & ((ulonglong)1<<i))
+ res++;
+ }
+ return res;
+ }
};