This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Bug fix for count_leading_zeros
- To: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner), egcs at cygnus dot com, tege at nada dot kth dot se (Torbjorn Granlund)
- Subject: Bug fix for count_leading_zeros
- From: Joern Rennecke <amylaar at cygnus dot co dot uk>
- Date: Fri, 17 Oct 1997 06:42:29 +0100 (BST)
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 \
{ \