diff mbox

use W_TYPE_SIZE more in libgcc

Message ID 20110322123003.GA6010@nightcrawler
State New
Headers show

Commit Message

Nathan Froyd March 22, 2011, 12:30 p.m. UTC
There are several places in libgcc where the expression
'sizeof (Wtype) * BITS_PER_UNIT' is used.  We have a perfectly good
expression, W_TYPE_SIZE, for this; the patch below replaces the sizeof
expression with W_TYPE_SIZE.

Tested on x86_64-unknown-linux-gnu.  I think this counts as obvious, so
I will be committing it in the absence of comments.

-Nathan

	* libgcc2.c (__lshrdi3, __ashldi3, __ashrdi3): Use W_TYPE_SIZE.
	(__ffsDI2): Likewise.
diff mbox

Patch

Index: gcc/libgcc2.c
===================================================================
--- gcc/libgcc2.c	(revision 171278)
+++ gcc/libgcc2.c	(working copy)
@@ -407,7 +407,7 @@  __lshrdi3 (DWtype u, shift_count_type b)
     return u;
 
   const DWunion uu = {.ll = u};
-  const shift_count_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b;
+  const shift_count_type bm = W_TYPE_SIZE - b;
   DWunion w;
 
   if (bm <= 0)
@@ -435,7 +435,7 @@  __ashldi3 (DWtype u, shift_count_type b)
     return u;
 
   const DWunion uu = {.ll = u};
-  const shift_count_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b;
+  const shift_count_type bm = W_TYPE_SIZE - b;
   DWunion w;
 
   if (bm <= 0)
@@ -463,13 +463,13 @@  __ashrdi3 (DWtype u, shift_count_type b)
     return u;
 
   const DWunion uu = {.ll = u};
-  const shift_count_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b;
+  const shift_count_type bm = W_TYPE_SIZE - b;
   DWunion w;
 
   if (bm <= 0)
     {
       /* w.s.high = 1..1 or 0..0 */
-      w.s.high = uu.s.high >> (sizeof (Wtype) * BITS_PER_UNIT - 1);
+      w.s.high = uu.s.high >> (W_TYPE_SIZE - 1);
       w.s.low = uu.s.high >> -bm;
     }
   else
@@ -534,7 +534,7 @@  __ffsDI2 (DWtype u)
   if (uu.s.low != 0)
     word = uu.s.low, add = 0;
   else if (uu.s.high != 0)
-    word = uu.s.high, add = BITS_PER_UNIT * sizeof (Wtype);
+    word = uu.s.high, add = W_TYPE_SIZE;
   else
     return 0;