1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-16 20:23:18 +03:00

ndb - Test program for new bitmask functions

This commit is contained in:
joreland@mysql.com
2004-12-07 20:58:46 +01:00
parent ba83763a77
commit eda8685471
3 changed files with 229 additions and 5 deletions

View File

@@ -148,6 +148,9 @@ public:
* getText - Return as hex-digits (only for debug routines).
*/
static char* getText(unsigned size, const Uint32 data[], char* buf);
private:
static void getFieldImpl(const Uint32 data[], unsigned, unsigned, Uint32 []);
static void setFieldImpl(Uint32 data[], unsigned, unsigned, const Uint32 []);
};
inline bool
@@ -820,7 +823,7 @@ BitmaskImpl::getField(unsigned size, const Uint32 data[],
dst[0] = (data[word] >> offset) & ((1 << len) - 1);
return;
}
abort();
getFieldImpl(data, pos, len, dst);
}
inline void
@@ -831,13 +834,13 @@ BitmaskImpl::setField(unsigned size, Uint32 data[],
assert(pos + len < (size << 5));
Uint32 word = pos >> 5;
Uint32 offset = pos & 31;
Uint32 mask = ((1 << len) - 1) << offset;
data[word] = (data[word] & ~mask) | ((src[0] << offset) & mask);
if(offset + len <= 32)
{
Uint32 mask = ((1 << len) - 1) << offset;
data[word] = (data[word] & ~mask) | ((src[0] << offset) & mask);
return;
}
abort();
setFieldImpl(data, pos, len, src);
}