public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Bug fix for count_leading_zeros
@ 1997-10-16 22:44 Joern Rennecke
  0 siblings, 0 replies; only message in thread
From: Joern Rennecke @ 1997-10-16 22:44 UTC (permalink / raw)
  To: Richard Kenner, egcs, Torbjorn Granlund

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								\
        {									\

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-10-16 22:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-16 22:44 Bug fix for count_leading_zeros Joern Rennecke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).