]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[PATCH] ARM: Lindent GCC helper functions
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Mon, 20 Jun 2005 15:45:32 +0000 (16:45 +0100)
committerRussell King <rmk@dyn-67.arm.linux.org.uk>
Mon, 20 Jun 2005 15:45:32 +0000 (16:45 +0100)
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/lib/ashldi3.c
arch/arm/lib/ashrdi3.c
arch/arm/lib/gcclib.h
arch/arm/lib/longlong.h
arch/arm/lib/lshrdi3.c
arch/arm/lib/muldi3.c
arch/arm/lib/ucmpdi2.c
arch/arm/lib/udivdi3.c

index 02d2b628ebc1c3e0b98daf37b58434625cb57d3c..b62875cfd8f842fdc85c4e32ee9769b93fef920c 100644 (file)
@@ -31,31 +31,26 @@ Boston, MA 02111-1307, USA.  */
 
 #include "gcclib.h"
 
-s64
-__ashldi3 (s64 u, int b)
+s64 __ashldi3(s64 u, int b)
 {
-  DIunion w;
-  int bm;
-  DIunion uu;
-
-  if (b == 0)
-    return u;
-
-  uu.ll = u;
-
-  bm = (sizeof (s32) * BITS_PER_UNIT) - b;
-  if (bm <= 0)
-    {
-      w.s.low = 0;
-      w.s.high = (u32)uu.s.low << -bm;
-    }
-  else
-    {
-      u32 carries = (u32)uu.s.low >> bm;
-      w.s.low = (u32)uu.s.low << b;
-      w.s.high = ((u32)uu.s.high << b) | carries;
-    }
-
-  return w.ll;
+       DIunion w;
+       int bm;
+       DIunion uu;
+
+       if (b == 0)
+               return u;
+
+       uu.ll = u;
+
+       bm = (sizeof(s32) * BITS_PER_UNIT) - b;
+       if (bm <= 0) {
+               w.s.low = 0;
+               w.s.high = (u32) uu.s.low << -bm;
+       } else {
+               u32 carries = (u32) uu.s.low >> bm;
+               w.s.low = (u32) uu.s.low << b;
+               w.s.high = ((u32) uu.s.high << b) | carries;
+       }
+
+       return w.ll;
 }
-
index 89f6fb7ed8fb2457fb39b09e65382a504fa66f49..9a8600a7543faf8159d029bf5b2dce40c8802852 100644 (file)
@@ -31,31 +31,27 @@ Boston, MA 02111-1307, USA.  */
 
 #include "gcclib.h"
 
-s64
-__ashrdi3 (s64 u, int b)
+s64 __ashrdi3(s64 u, int b)
 {
-  DIunion w;
-  int bm;
-  DIunion uu;
-
-  if (b == 0)
-    return u;
-
-  uu.ll = u;
-
-  bm = (sizeof (s32) * BITS_PER_UNIT) - b;
-  if (bm <= 0)
-    {
-      /* w.s.high = 1..1 or 0..0 */
-      w.s.high = uu.s.high >> (sizeof (s32) * BITS_PER_UNIT - 1);
-      w.s.low = uu.s.high >> -bm;
-    }
-  else
-    {
-      u32 carries = (u32)uu.s.high << bm;
-      w.s.high = uu.s.high >> b;
-      w.s.low = ((u32)uu.s.low >> b) | carries;
-    }
-
-  return w.ll;
+       DIunion w;
+       int bm;
+       DIunion uu;
+
+       if (b == 0)
+               return u;
+
+       uu.ll = u;
+
+       bm = (sizeof(s32) * BITS_PER_UNIT) - b;
+       if (bm <= 0) {
+               /* w.s.high = 1..1 or 0..0 */
+               w.s.high = uu.s.high >> (sizeof(s32) * BITS_PER_UNIT - 1);
+               w.s.low = uu.s.high >> -bm;
+       } else {
+               u32 carries = (u32) uu.s.high << bm;
+               w.s.high = uu.s.high >> b;
+               w.s.low = ((u32) uu.s.low >> b) | carries;
+       }
+
+       return w.ll;
 }
index 283f5294cc3e17d72ce7a4da51611973c2de801a..8b6dcc656de779c3b2d030f0577238fe59e41954 100644 (file)
@@ -3,18 +3,20 @@
 
 #include <linux/types.h>
 
-#define BITS_PER_UNIT  8
-#define SI_TYPE_SIZE (sizeof(s32) * BITS_PER_UNIT)
+#define BITS_PER_UNIT  8
+#define SI_TYPE_SIZE   (sizeof(s32) * BITS_PER_UNIT)
 
 #ifdef __ARMEB__
-  struct DIstruct {s32 high, low;};
+struct DIstruct {
+       s32 high, low;
+};
 #else
-  struct DIstruct {s32 low, high;};
+struct DIstruct {
+       s32 low, high;
+};
 #endif
 
-typedef union
-{
-  struct DIstruct s;
-  s64 ll;
+typedef union {
+       struct DIstruct s;
+       s64 ll;
 } DIunion;
-
index 3ef76957481ea39e33b236e3448946b0ec2beaed..90ae647e4d76dadf575c4395e87affce807f0e19 100644 (file)
             "r" ((u32) (b)));}
 #define UMUL_TIME 20
 #define UDIV_TIME 100
-#endif /* __arm__ */
+#endif                         /* __arm__ */
 
 #define __umulsidi3(u, v) \
   ({DIunion __w;                                                       \
index 5c2385acdecc78aa530ebcbfaac9404af2535697..3681f49d2b6e24c43c3d4b1670e57f2f50ebb1dd 100644 (file)
@@ -31,31 +31,26 @@ Boston, MA 02111-1307, USA.  */
 
 #include "gcclib.h"
 
-s64
-__lshrdi3 (s64 u, int b)
+s64 __lshrdi3(s64 u, int b)
 {
-  DIunion w;
-  int bm;
-  DIunion uu;
-
-  if (b == 0)
-    return u;
-
-  uu.ll = u;
-
-  bm = (sizeof (s32) * BITS_PER_UNIT) - b;
-  if (bm <= 0)
-    {
-      w.s.high = 0;
-      w.s.low = (u32)uu.s.high >> -bm;
-    }
-  else
-    {
-      u32 carries = (u32)uu.s.high << bm;
-      w.s.high = (u32)uu.s.high >> b;
-      w.s.low = ((u32)uu.s.low >> b) | carries;
-    }
-
-  return w.ll;
+       DIunion w;
+       int bm;
+       DIunion uu;
+
+       if (b == 0)
+               return u;
+
+       uu.ll = u;
+
+       bm = (sizeof(s32) * BITS_PER_UNIT) - b;
+       if (bm <= 0) {
+               w.s.high = 0;
+               w.s.low = (u32) uu.s.high >> -bm;
+       } else {
+               u32 carries = (u32) uu.s.high << bm;
+               w.s.high = (u32) uu.s.high >> b;
+               w.s.low = ((u32) uu.s.low >> b) | carries;
+       }
+
+       return w.ll;
 }
-
index 5b649fa9e2f7f961e650170822a79700c1410330..0a3b93313f1831b24ef778f595a9d9bca0571a93 100644 (file)
@@ -52,26 +52,21 @@ Boston, MA 02111-1307, USA.  */
            : "r" ((u32) (a)),                                       \
              "r" ((u32) (b)));}
 
-
 #define __umulsidi3(u, v) \
   ({DIunion __w;                                                        \
     umul_ppmm (__w.s.high, __w.s.low, u, v);                            \
     __w.ll; })
 
-
-s64
-__muldi3 (s64 u, s64 v)
+s64 __muldi3(s64 u, s64 v)
 {
-  DIunion w;
-  DIunion uu, vv;
+       DIunion w;
+       DIunion uu, vv;
 
-  uu.ll = u,
-  vv.ll = v;
+       uu.ll = u, vv.ll = v;
 
-  w.ll = __umulsidi3 (uu.s.low, vv.s.low);
-  w.s.high += ((u32) uu.s.low * (u32) vv.s.high
-               + (u32) uu.s.high * (u32) vv.s.low);
+       w.ll = __umulsidi3(uu.s.low, vv.s.low);
+       w.s.high += ((u32) uu.s.low * (u32) vv.s.high
+                    + (u32) uu.s.high * (u32) vv.s.low);
 
-  return w.ll;
+       return w.ll;
 }
-
index 3eb438c065b358890418f3db1fc8b958ad3ee27a..57f3f2df3850147286d89f870912cf40486d2d66 100644 (file)
@@ -31,21 +31,19 @@ Boston, MA 02111-1307, USA.  */
 
 #include "gcclib.h"
 
-int
-__ucmpdi2 (s64 a, s64 b)
+int __ucmpdi2(s64 a, s64 b)
 {
-  DIunion au, bu;
-
-  au.ll = a, bu.ll = b;
-
-  if ((u32) au.s.high < (u32) bu.s.high)
-    return 0;
-  else if ((u32) au.s.high > (u32) bu.s.high)
-    return 2;
-  if ((u32) au.s.low < (u32) bu.s.low)
-    return 0;
-  else if ((u32) au.s.low > (u32) bu.s.low)
-    return 2;
-  return 1;
+       DIunion au, bu;
+
+       au.ll = a, bu.ll = b;
+
+       if ((u32) au.s.high < (u32) bu.s.high)
+               return 0;
+       else if ((u32) au.s.high > (u32) bu.s.high)
+               return 2;
+       if ((u32) au.s.low < (u32) bu.s.low)
+               return 0;
+       else if ((u32) au.s.low > (u32) bu.s.low)
+               return 2;
+       return 1;
 }
-
index df1d5ef62bc7fe966cd9934c253d82a788876089..e343be4c66421c9b6d2524f11e7858b02db369f9 100644 (file)
@@ -32,211 +32,191 @@ Boston, MA 02111-1307, USA.  */
 #include "gcclib.h"
 #include "longlong.h"
 
-static const u8 __clz_tab[] =
-{
-  0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-  6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+static const u8 __clz_tab[] = {
+       0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
+           5, 5, 5, 5, 5, 5, 5, 5,
+       6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+           6, 6, 6, 6, 6, 6, 6, 6,
+       7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+           7, 7, 7, 7, 7, 7, 7, 7,
+       7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+           7, 7, 7, 7, 7, 7, 7, 7,
+       8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+           8, 8, 8, 8, 8, 8, 8, 8,
+       8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+           8, 8, 8, 8, 8, 8, 8, 8,
+       8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+           8, 8, 8, 8, 8, 8, 8, 8,
+       8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+           8, 8, 8, 8, 8, 8, 8, 8,
 };
 
-u64
-__udivmoddi4 (u64 n, u64 d, u64 *rp)
+u64 __udivmoddi4(u64 n, u64 d, u64 * rp)
 {
-  DIunion ww;
-  DIunion nn, dd;
-  DIunion rr;
-  u32 d0, d1, n0, n1, n2;
-  u32 q0, q1;
-  u32 b, bm;
-
-  nn.ll = n;
-  dd.ll = d;
-
-  d0 = dd.s.low;
-  d1 = dd.s.high;
-  n0 = nn.s.low;
-  n1 = nn.s.high;
-
-  if (d1 == 0)
-    {
-      if (d0 > n1)
-        {
-          /* 0q = nn / 0D */
-
-          count_leading_zeros (bm, d0);
-
-          if (bm != 0)
-            {
-              /* Normalize, i.e. make the most significant bit of the
-                 denominator set.  */
-
-              d0 = d0 << bm;
-              n1 = (n1 << bm) | (n0 >> (SI_TYPE_SIZE - bm));
-              n0 = n0 << bm;
-            }
-
-          udiv_qrnnd (q0, n0, n1, n0, d0);
-          q1 = 0;
-
-          /* Remainder in n0 >> bm.  */
-        }
-      else
-        {
-          /* qq = NN / 0d */
-
-          if (d0 == 0)
-            d0 = 1 / d0;        /* Divide intentionally by zero.  */
-
-          count_leading_zeros (bm, d0);
-
-          if (bm == 0)
-            {
-              /* From (n1 >= d0) /\ (the most significant bit of d0 is set),
-                 conclude (the most significant bit of n1 is set) /\ (the
-                 leading quotient digit q1 = 1).
-
-                 This special case is necessary, not an optimization.
-                 (Shifts counts of SI_TYPE_SIZE are undefined.)  */
-
-              n1 -= d0;
-              q1 = 1;
-            }
-          else
-            {
-              /* Normalize.  */
-
-              b = SI_TYPE_SIZE - bm;
-
-              d0 = d0 << bm;
-              n2 = n1 >> b;
-              n1 = (n1 << bm) | (n0 >> b);
-              n0 = n0 << bm;
-
-              udiv_qrnnd (q1, n1, n2, n1, d0);
-            }
-
-          /* n1 != d0...  */
-
-          udiv_qrnnd (q0, n0, n1, n0, d0);
-
-          /* Remainder in n0 >> bm.  */
-        }
-
-      if (rp != 0)
-        {
-          rr.s.low = n0 >> bm;
-          rr.s.high = 0;
-          *rp = rr.ll;
-        }
-    }
-  else
-    {
-      if (d1 > n1)
-        {
-          /* 00 = nn / DD */
-
-          q0 = 0;
-          q1 = 0;
-
-          /* Remainder in n1n0.  */
-          if (rp != 0)
-            {
-              rr.s.low = n0;
-              rr.s.high = n1;
-              *rp = rr.ll;
-            }
-        }
-      else
-        {
-          /* 0q = NN / dd */
-
-          count_leading_zeros (bm, d1);
-          if (bm == 0)
-            {
-              /* From (n1 >= d1) /\ (the most significant bit of d1 is set),
-                 conclude (the most significant bit of n1 is set) /\ (the
-                 quotient digit q0 = 0 or 1).
-
-                 This special case is necessary, not an optimization.  */
-
-              /* The condition on the next line takes advantage of that
-                 n1 >= d1 (true due to program flow).  */
-              if (n1 > d1 || n0 >= d0)
-                {
-                  q0 = 1;
-                  sub_ddmmss (n1, n0, n1, n0, d1, d0);
-                }
-              else
-                q0 = 0;
-
-              q1 = 0;
-
-              if (rp != 0)
-                {
-                  rr.s.low = n0;
-                  rr.s.high = n1;
-                  *rp = rr.ll;
-                }
-            }
-          else
-            {
-              u32 m1, m0;
-              /* Normalize.  */
-
-              b = SI_TYPE_SIZE - bm;
-
-              d1 = (d1 << bm) | (d0 >> b);
-              d0 = d0 << bm;
-              n2 = n1 >> b;
-              n1 = (n1 << bm) | (n0 >> b);
-              n0 = n0 << bm;
-
-              udiv_qrnnd (q0, n1, n2, n1, d1);
-              umul_ppmm (m1, m0, q0, d0);
-
-              if (m1 > n1 || (m1 == n1 && m0 > n0))
-                {
-                  q0--;
-                  sub_ddmmss (m1, m0, m1, m0, d1, d0);
-                }
-
-              q1 = 0;
-
-              /* Remainder in (n1n0 - m1m0) >> bm.  */
-              if (rp != 0)
-                {
-                  sub_ddmmss (n1, n0, n1, n0, m1, m0);
-                  rr.s.low = (n1 << b) | (n0 >> bm);
-                  rr.s.high = n1 >> bm;
-                  *rp = rr.ll;
-                }
-            }
-        }
-    }
-
-  ww.s.low = q0;
-  ww.s.high = q1;
-  return ww.ll;
+       DIunion ww;
+       DIunion nn, dd;
+       DIunion rr;
+       u32 d0, d1, n0, n1, n2;
+       u32 q0, q1;
+       u32 b, bm;
+
+       nn.ll = n;
+       dd.ll = d;
+
+       d0 = dd.s.low;
+       d1 = dd.s.high;
+       n0 = nn.s.low;
+       n1 = nn.s.high;
+
+       if (d1 == 0) {
+               if (d0 > n1) {
+                       /* 0q = nn / 0D */
+
+                       count_leading_zeros(bm, d0);
+
+                       if (bm != 0) {
+                               /* Normalize, i.e. make the most significant bit of the
+                                  denominator set.  */
+
+                               d0 = d0 << bm;
+                               n1 = (n1 << bm) | (n0 >> (SI_TYPE_SIZE - bm));
+                               n0 = n0 << bm;
+                       }
+
+                       udiv_qrnnd(q0, n0, n1, n0, d0);
+                       q1 = 0;
+
+                       /* Remainder in n0 >> bm.  */
+               } else {
+                       /* qq = NN / 0d */
+
+                       if (d0 == 0)
+                               d0 = 1 / d0;    /* Divide intentionally by zero.  */
+
+                       count_leading_zeros(bm, d0);
+
+                       if (bm == 0) {
+                               /* From (n1 >= d0) /\ (the most significant bit of d0 is set),
+                                  conclude (the most significant bit of n1 is set) /\ (the
+                                  leading quotient digit q1 = 1).
+
+                                  This special case is necessary, not an optimization.
+                                  (Shifts counts of SI_TYPE_SIZE are undefined.)  */
+
+                               n1 -= d0;
+                               q1 = 1;
+                       } else {
+                               /* Normalize.  */
+
+                               b = SI_TYPE_SIZE - bm;
+
+                               d0 = d0 << bm;
+                               n2 = n1 >> b;
+                               n1 = (n1 << bm) | (n0 >> b);
+                               n0 = n0 << bm;
+
+                               udiv_qrnnd(q1, n1, n2, n1, d0);
+                       }
+
+                       /* n1 != d0...  */
+
+                       udiv_qrnnd(q0, n0, n1, n0, d0);
+
+                       /* Remainder in n0 >> bm.  */
+               }
+
+               if (rp != 0) {
+                       rr.s.low = n0 >> bm;
+                       rr.s.high = 0;
+                       *rp = rr.ll;
+               }
+       } else {
+               if (d1 > n1) {
+                       /* 00 = nn / DD */
+
+                       q0 = 0;
+                       q1 = 0;
+
+                       /* Remainder in n1n0.  */
+                       if (rp != 0) {
+                               rr.s.low = n0;
+                               rr.s.high = n1;
+                               *rp = rr.ll;
+                       }
+               } else {
+                       /* 0q = NN / dd */
+
+                       count_leading_zeros(bm, d1);
+                       if (bm == 0) {
+                               /* From (n1 >= d1) /\ (the most significant bit of d1 is set),
+                                  conclude (the most significant bit of n1 is set) /\ (the
+                                  quotient digit q0 = 0 or 1).
+
+                                  This special case is necessary, not an optimization.  */
+
+                               /* The condition on the next line takes advantage of that
+                                  n1 >= d1 (true due to program flow).  */
+                               if (n1 > d1 || n0 >= d0) {
+                                       q0 = 1;
+                                       sub_ddmmss(n1, n0, n1, n0, d1, d0);
+                               } else
+                                       q0 = 0;
+
+                               q1 = 0;
+
+                               if (rp != 0) {
+                                       rr.s.low = n0;
+                                       rr.s.high = n1;
+                                       *rp = rr.ll;
+                               }
+                       } else {
+                               u32 m1, m0;
+                               /* Normalize.  */
+
+                               b = SI_TYPE_SIZE - bm;
+
+                               d1 = (d1 << bm) | (d0 >> b);
+                               d0 = d0 << bm;
+                               n2 = n1 >> b;
+                               n1 = (n1 << bm) | (n0 >> b);
+                               n0 = n0 << bm;
+
+                               udiv_qrnnd(q0, n1, n2, n1, d1);
+                               umul_ppmm(m1, m0, q0, d0);
+
+                               if (m1 > n1 || (m1 == n1 && m0 > n0)) {
+                                       q0--;
+                                       sub_ddmmss(m1, m0, m1, m0, d1, d0);
+                               }
+
+                               q1 = 0;
+
+                               /* Remainder in (n1n0 - m1m0) >> bm.  */
+                               if (rp != 0) {
+                                       sub_ddmmss(n1, n0, n1, n0, m1, m0);
+                                       rr.s.low = (n1 << b) | (n0 >> bm);
+                                       rr.s.high = n1 >> bm;
+                                       *rp = rr.ll;
+                               }
+                       }
+               }
+       }
+
+       ww.s.low = q0;
+       ww.s.high = q1;
+       return ww.ll;
 }
 
-u64
-__udivdi3 (u64 n, u64 d)
+u64 __udivdi3(u64 n, u64 d)
 {
-  return __udivmoddi4 (n, d, (u64 *) 0);
+       return __udivmoddi4(n, d, (u64 *) 0);
 }
 
-u64
-__umoddi3 (u64 u, u64 v)
+u64 __umoddi3(u64 u, u64 v)
 {
-  u64 w;
+       u64 w;
 
-  (void) __udivmoddi4 (u ,v, &w);
+       (void)__udivmoddi4(u, v, &w);
 
-  return w;
+       return w;
 }
-