This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Bug fix for count_leading_zeros


count_leading_zeros in longlong.h shifts integer values by
a shift count of up to 24.  This causes problems for hosts with 16 bit
ints.  Here is a fix:

Fri Oct 17 02:44:16 1997 J"orn Rennecke <amylaar@cygnus.co.uk>

	* (count_leading_zeros): Add missing casts to USItype.

Index: longlong.h
===================================================================
RCS file: /cvs/cvsfiles/egcs/gcc/longlong.h,v
retrieving revision 1.2
diff -p -r1.2 longlong.h
*** longlong.h	1997/09/10 07:50:20	1.2
--- longlong.h	1997/10/17 05:35:14
*************** extern const UQItype __clz_tab[];
*** 1236,1244 ****
  									\
      if (SI_TYPE_SIZE <= 32)						\
        {									\
! 	__a = __xr < (1<<2*__BITS4)					\
! 	  ? (__xr < (1<<__BITS4) ? 0 : __BITS4)				\
! 	  : (__xr < (1<<3*__BITS4) ?  2*__BITS4 : 3*__BITS4);		\
        }									\
      else								\
        {									\
--- 1236,1244 ----
  									\
      if (SI_TYPE_SIZE <= 32)						\
        {									\
! 	__a = __xr < ((USItype)1<<2*__BITS4)				\
! 	  ? (__xr < ((USItype)1<<__BITS4) ? 0 : __BITS4)		\
! 	  : (__xr < ((USItype)1<<3*__BITS4) ?  2*__BITS4 : 3*__BITS4);	\
        }									\
      else								\
        {									\


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]