summaryrefslogtreecommitdiff
path: root/sql/sql_bitmap.h
diff options
context:
space:
mode:
authortomas@poseidon.ndb.mysql.com <>2005-06-04 19:26:35 +0200
committertomas@poseidon.ndb.mysql.com <>2005-06-04 19:26:35 +0200
commitf6d51a44f48a9fc97d8b17e44f3f66f982e84e02 (patch)
tree5a32b384f0388487fb7fee12035b2f2e36fb75d9 /sql/sql_bitmap.h
parente9307aaca9af294192f574ab87d46c5e4f9287c2 (diff)
parent10f8d83dcb7637b3668fc42d85af9bdca44e9c60 (diff)
downloadmariadb-git-f6d51a44f48a9fc97d8b17e44f3f66f982e84e02.tar.gz
Merge
Diffstat (limited to 'sql/sql_bitmap.h')
-rw-r--r--sql/sql_bitmap.h24
1 files changed, 11 insertions, 13 deletions
diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h
index bd137e15b90..5e5bb1d8d3b 100644
--- a/sql/sql_bitmap.h
+++ b/sql/sql_bitmap.h
@@ -28,7 +28,7 @@ template <uint default_width> class Bitmap
uint32 buffer[(default_width+31)/32];
public:
Bitmap() { init(); }
- Bitmap(Bitmap& from) { *this=from; }
+ Bitmap(const Bitmap& from) { *this=from; }
explicit Bitmap(uint prefix_to_set) { init(prefix_to_set); }
void init() { bitmap_init(&map, buffer, default_width, 0); }
void init(uint prefix_to_set) { init(); set_prefix(prefix_to_set); }
@@ -61,19 +61,17 @@ public:
my_bool operator==(const Bitmap& map2) const { return bitmap_cmp(&map, &map2.map); }
char *print(char *buf) const
{
- char *s=buf; int i;
- uchar *uchar_buffer= (uchar*)&buffer;
- for (i=sizeof(buffer)-1; i>=0 ; i--)
+ char *s=buf;
+ const uchar *e=buffer, *b=e+sizeof(buffer)-1;
+ while (!*b && b>e)
+ b--;
+ if ((*s=_dig_vec_upper[*b >> 4]) != '0')
+ s++;
+ *s++=_dig_vec_upper[*b & 15];
+ while (--b>=e)
{
- if ((*s=_dig_vec_upper[uchar_buffer[i] >> 4]) != '0')
- break;
- if ((*s=_dig_vec_upper[uchar_buffer[i] & 15]) != '0')
- break;
- }
- for (s++, i-- ; i>=0 ; i--)
- {
- *s++=_dig_vec_upper[uchar_buffer[i] >> 4];
- *s++=_dig_vec_upper[uchar_buffer[i] & 15];
+ *s++=_dig_vec_upper[*b >> 4];
+ *s++=_dig_vec_upper[*b & 15];
}
*s=0;
return buf;