projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tests for module 'unicase/u16-is-uppercase'.
[gnulib.git]
/
lib
/
count-one-bits.h
diff --git
a/lib/count-one-bits.h
b/lib/count-one-bits.h
index
e4a477b
..
fcbe7fd
100644
(file)
--- a/
lib/count-one-bits.h
+++ b/
lib/count-one-bits.h
@@
-1,10
+1,10
@@
/* count-one-bits.h -- counts the number of 1-bits in a word.
/* count-one-bits.h -- counts the number of 1-bits in a word.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007
-2008
Free Software Foundation, Inc.
- This program is free software
;
you can redistribute it and/or modify
+ 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
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version
2, or (at your option)
- any later version.
+ the Free Software Foundation; either version
3 of the License, or
+
(at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-12,8
+12,7
@@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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 Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Ben Pfaff. */
/* Written by Ben Pfaff. */
@@
-26,12
+25,14
@@
/* Expand the code which computes the number of 1-bits of the local
variable 'x' of type TYPE (an unsigned integer type) and returns it
from the current function. */
/* Expand the code which computes the number of 1-bits of the local
variable 'x' of type TYPE (an unsigned integer type) and returns it
from the current function. */
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR >= 4)
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR
__
>= 4)
#define COUNT_ONE_BITS(BUILTIN, TYPE) \
return BUILTIN (x);
#else
#define COUNT_ONE_BITS(BUILTIN, TYPE) \
#define COUNT_ONE_BITS(BUILTIN, TYPE) \
return BUILTIN (x);
#else
#define COUNT_ONE_BITS(BUILTIN, TYPE) \
- verify ((TYPE) -1 >> 31 >> 31 <= 3); /* TYPE has at most 64 bits */ \
+ /* This condition is written so as to avoid shifting by more than \
+ 31 bits at once, and also avoids a random HP-UX cc bug. */ \
+ verify (((TYPE) -1 >> 31 >> 31 >> 2) == 0); /* TYPE has at most 64 bits */ \
int count = count_one_bits_32 (x); \
if (1 < (TYPE) -1 >> 31) /* TYPE has more than 32 bits? */ \
count += count_one_bits_32 (x >> 31 >> 1); \
int count = count_one_bits_32 (x); \
if (1 < (TYPE) -1 >> 31) /* TYPE has more than 32 bits? */ \
count += count_one_bits_32 (x >> 31 >> 1); \