summaryrefslogtreecommitdiff
path: root/include/my_bit.h
diff options
context:
space:
mode:
authorJon Olav Hauglid <jon.hauglid@oracle.com>2011-02-16 16:33:02 +0100
committerJon Olav Hauglid <jon.hauglid@oracle.com>2011-02-16 16:33:02 +0100
commitf65f016aeeba1e7cee6cd3f4f07599cfb92d3001 (patch)
tree73727eac8d3bcd4f7827ae75e5040dce9818c5b4 /include/my_bit.h
parente24f16a6cd7786b0900be12484f45f8bcbd8006b (diff)
parent6ad0c9b16daccb64ec34dffc8a21e73ca9c6073d (diff)
downloadmariadb-git-f65f016aeeba1e7cee6cd3f4f07599cfb92d3001.tar.gz
Merge from mysql-5.1 to mysql-5.5
Text conflict in include/my_bit.h Text conflict in include/my_bitmap.h Text conflict in mysys/my_bitmap.c
Diffstat (limited to 'include/my_bit.h')
-rw-r--r--include/my_bit.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/include/my_bit.h b/include/my_bit.h
index b396b84b0d8..cdb0680b652 100644
--- a/include/my_bit.h
+++ b/include/my_bit.h
@@ -1,3 +1,18 @@
+/* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
#ifndef MY_BIT_INCLUDED
#define MY_BIT_INCLUDED
@@ -44,9 +59,12 @@ static inline uint my_count_bits(ulonglong v)
#endif
}
-static inline uint my_count_bits_ushort(ushort v)
+static inline uint my_count_bits_uint32(uint32 v)
{
- return _my_bits_nbits[v];
+ return (uint) (uchar) (_my_bits_nbits[(uchar) v] +
+ _my_bits_nbits[(uchar) (v >> 8)] +
+ _my_bits_nbits[(uchar) (v >> 16)] +
+ _my_bits_nbits[(uchar) (v >> 24)]);
}