Commit 47f379d2 authored by jonas@perch.ndb.mysql.com's avatar jonas@perch.ndb.mysql.com

Merge perch.ndb.mysql.com:/home/jonas/src/51-telco-gca

into  perch.ndb.mysql.com:/home/jonas/src/51-ndb
parents ddf645b1 94378f91
...@@ -139,6 +139,7 @@ public: ...@@ -139,6 +139,7 @@ public:
/** /**
* setField - Set bitfield at given position and length (max 32 bits) * setField - Set bitfield at given position and length (max 32 bits)
* Note : length == 0 not supported.
*/ */
static void setField(unsigned size, Uint32 data[], static void setField(unsigned size, Uint32 data[],
unsigned pos, unsigned len, Uint32 val); unsigned pos, unsigned len, Uint32 val);
...@@ -146,6 +147,7 @@ public: ...@@ -146,6 +147,7 @@ public:
/** /**
* getField - Get bitfield at given position and length * getField - Get bitfield at given position and length
* Note : length == 0 not supported.
*/ */
static void getField(unsigned size, const Uint32 data[], static void getField(unsigned size, const Uint32 data[],
unsigned pos, unsigned len, Uint32 dst[]); unsigned pos, unsigned len, Uint32 dst[]);
...@@ -918,7 +920,10 @@ BitmaskImpl::getField(unsigned size, const Uint32 src[], ...@@ -918,7 +920,10 @@ BitmaskImpl::getField(unsigned size, const Uint32 src[],
unsigned pos, unsigned len, Uint32 dst[]) unsigned pos, unsigned len, Uint32 dst[])
{ {
assert(pos + len <= (size << 5)); assert(pos + len <= (size << 5));
assert (len != 0);
if (len == 0)
return;
src += (pos >> 5); src += (pos >> 5);
Uint32 offset = pos & 31; Uint32 offset = pos & 31;
* dst = (* src >> offset) & (len >= 32 ? ~0 : (1 << len) - 1); * dst = (* src >> offset) & (len >= 32 ? ~0 : (1 << len) - 1);
...@@ -937,6 +942,9 @@ BitmaskImpl::setField(unsigned size, Uint32 dst[], ...@@ -937,6 +942,9 @@ BitmaskImpl::setField(unsigned size, Uint32 dst[],
unsigned pos, unsigned len, const Uint32 src[]) unsigned pos, unsigned len, const Uint32 src[])
{ {
assert(pos + len <= (size << 5)); assert(pos + len <= (size << 5));
assert(len != 0);
if (len == 0)
return;
dst += (pos >> 5); dst += (pos >> 5);
Uint32 offset = pos & 31; Uint32 offset = pos & 31;
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment