X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fcount-one-bits.h;h=1d84ef0fff151bd58937a1c867f736e98e19a576;hb=630a387fb1ef0a2fda5fd73c02c37328d65d0755;hp=b1087c3ea262ae089a24880f7bdee2296fa670a8;hpb=1d926bafeda3f6344f4c715357d1086a2f1a5359;p=gnulib.git diff --git a/lib/count-one-bits.h b/lib/count-one-bits.h index b1087c3ea..1d84ef0ff 100644 --- a/lib/count-one-bits.h +++ b/lib/count-one-bits.h @@ -1,5 +1,5 @@ /* count-one-bits.h -- counts the number of 1-bits in a word. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. 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 @@ -30,7 +30,9 @@ 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); \