1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-29 00:08:14 +03:00

wl2723 - ndb opt. nr

This commit is contained in:
jonas@perch.ndb.mysql.com
2006-01-11 11:35:25 +01:00
parent 0f7214d9dc
commit 161645c81e
138 changed files with 9336 additions and 3311 deletions

View File

@@ -47,6 +47,11 @@ public:
*/
static void set(unsigned size, Uint32 data[]);
/**
* set bit from <em>start</em> to <em>last</em>
*/
static void set_range(unsigned size, Uint32 data[], unsigned start, unsigned last);
/**
* assign - Set all bits in <em>dst</em> to corresponding in <em>src/<em>
*/
@@ -62,6 +67,11 @@ public:
*/
static void clear(unsigned size, Uint32 data[]);
/**
* clear bit from <em>start</em> to <em>last</em>
*/
static void clear_range(unsigned size, Uint32 data[], unsigned start, unsigned last);
static Uint32 getWord(unsigned size, Uint32 data[], unsigned word_pos);
static void setWord(unsigned size, Uint32 data[],
unsigned word_pos, Uint32 new_word);
@@ -184,6 +194,34 @@ BitmaskImpl::set(unsigned size, Uint32 data[])
}
}
inline void
BitmaskImpl::set_range(unsigned size, Uint32 data[],
unsigned start, unsigned last)
{
Uint32 *ptr = data + (start >> 5);
Uint32 *end = data + (last >> 5);
assert(start <= last);
assert(last < (size << 5));
Uint32 tmp_word = ~(Uint32)0 << (start & 31);
if (ptr < end)
{
* ptr ++ |= tmp_word;
for(; ptr < end; )
{
* ptr ++ = ~(Uint32)0;
}
tmp_word = ~(Uint32)0;
}
tmp_word &= ~(~(Uint32)0 << (last & 31));
* ptr |= tmp_word;
}
inline void
BitmaskImpl::assign(unsigned size, Uint32 dst[], const Uint32 src[])
{
@@ -207,6 +245,34 @@ BitmaskImpl::clear(unsigned size, Uint32 data[])
}
}
inline void
BitmaskImpl::clear_range(unsigned size, Uint32 data[],
unsigned start, unsigned last)
{
Uint32 *ptr = data + (start >> 5);
Uint32 *end = data + (last >> 5);
assert(start <= last);
assert(last < (size << 5));
Uint32 tmp_word = ~(Uint32)0 << (start & 31);
if (ptr < end)
{
* ptr ++ &= ~tmp_word;
for(; ptr < end; )
{
* ptr ++ = 0;
}
tmp_word = ~(Uint32)0;
}
tmp_word &= ~(~(Uint32)0 << (last & 31));
* ptr &= ~tmp_word;
}
inline
Uint32
BitmaskImpl::getWord(unsigned size, Uint32 data[], unsigned word_pos)