diff options
author | unknown <jonas@perch.ndb.mysql.com> | 2008-01-23 10:28:30 +0100 |
---|---|---|
committer | unknown <jonas@perch.ndb.mysql.com> | 2008-01-23 10:28:30 +0100 |
commit | bd70a104d92f7e7715b7cb776b752f4027ff5f4b (patch) | |
tree | 119303c6b44ba6758d056df47f90a6422e89b1cc /storage/ndb/include | |
parent | 4789e3f60669904a3032b59c6fb25f7ba6966bfe (diff) | |
parent | 71377f4163b5a26e1b918c14bc92531c0618a735 (diff) | |
download | mariadb-git-bd70a104d92f7e7715b7cb776b752f4027ff5f4b.tar.gz |
Merge perch.ndb.mysql.com:/home/jonas/src/51-telco-gca
into perch.ndb.mysql.com:/home/jonas/src/51-ndb
storage/ndb/src/common/util/Bitmask.cpp:
merge
Diffstat (limited to 'storage/ndb/include')
-rw-r--r-- | storage/ndb/include/util/Bitmask.hpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/storage/ndb/include/util/Bitmask.hpp b/storage/ndb/include/util/Bitmask.hpp index de47b79d393..d1663b7c76d 100644 --- a/storage/ndb/include/util/Bitmask.hpp +++ b/storage/ndb/include/util/Bitmask.hpp @@ -139,6 +139,7 @@ public: /** * setField - Set bitfield at given position and length (max 32 bits) + * Note : length == 0 not supported. */ static void setField(unsigned size, Uint32 data[], unsigned pos, unsigned len, Uint32 val); @@ -146,6 +147,7 @@ public: /** * getField - Get bitfield at given position and length + * Note : length == 0 not supported. */ static void getField(unsigned size, const Uint32 data[], unsigned pos, unsigned len, Uint32 dst[]); @@ -918,7 +920,10 @@ BitmaskImpl::getField(unsigned size, const Uint32 src[], unsigned pos, unsigned len, Uint32 dst[]) { assert(pos + len <= (size << 5)); - + assert (len != 0); + if (len == 0) + return; + src += (pos >> 5); Uint32 offset = pos & 31; * dst = (* src >> offset) & (len >= 32 ? ~0 : (1 << len) - 1); @@ -937,6 +942,9 @@ BitmaskImpl::setField(unsigned size, Uint32 dst[], unsigned pos, unsigned len, const Uint32 src[]) { assert(pos + len <= (size << 5)); + assert(len != 0); + if (len == 0) + return; dst += (pos >> 5); Uint32 offset = pos & 31; |