Print this page
11210 libm should be cstyle(1ONBLD) clean

@@ -16,13 +16,15 @@
  * fields enclosed by brackets "[]" replaced with your own identifying
  * information: Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
  */
+
 /*
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  */
+
 /*
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 

@@ -38,11 +40,12 @@
  * mode.  It's also fine for sparcv9 and amd64, although we have
  * assembly code on amd64.  For x86, it would be better to use
  * 32-bit code, but we have assembly for x86, too.
  */
 double
-fmod(double x, double y) {
+fmod(double x, double y)
+{
         double          w;
         long long       hx, ix, iy, iz;
         int             nd, k, ny;
 
         hx = *(long long *)&x;

@@ -55,31 +58,36 @@
 
         if (ix >= 0x7ff0000000000000ll || iy > 0x7ff0000000000000ll)
                 return ((x * y) * zero);
 
         if (ix <= iy)
-                return ((ix < iy)? x : x * zero);
+                return ((ix < iy) ? x : x *zero);
 
         /*
          * Set:
          *      ny = true exponent of y
          *      nd = true exponent of x minus true exponent of y
          *      ix = normalized significand of x
          *      iy = normalized significand of y
          */
         ny = iy >> 52;
         k = ix >> 52;
+
         if (ny == 0) {
                 /* y is subnormal, x could be normal or subnormal */
                 ny = 1;
+
                 while (iy < 0x0010000000000000ll) {
                         ny -= 1;
                         iy += iy;
                 }
+
                 nd = k - ny;
+
                 if (k == 0) {
                         nd += 1;
+
                         while (ix < 0x0010000000000000ll) {
                                 nd -= 1;
                                 ix += ix;
                         }
                 } else {

@@ -93,35 +101,43 @@
         }
 
         /* perform fixed point mod */
         while (nd--) {
                 iz = ix - iy;
+
                 if (iz >= 0)
                         ix = iz;
+
                 ix += ix;
         }
+
         iz = ix - iy;
+
         if (iz >= 0)
                 ix = iz;
 
         /* convert back to floating point and restore the sign */
         if (ix == 0ll)
                 return (x * zero);
+
         while (ix < 0x0010000000000000ll) {
                 ix += ix;
                 ny -= 1;
         }
+
         while (ix > 0x0020000000000000ll) {     /* XXX can this ever happen? */
                 ny += 1;
                 ix >>= 1;
         }
+
         if (ny <= 0) {
                 /* result is subnormal */
                 k = -ny + 1;
                 ix >>= k;
-                *(long long *)&w = (hx & 0x8000000000000000ull) | ix;
+                *(long long *) &w = (hx & 0x8000000000000000ull) | ix;
                 return (w);
         }
-        *(long long *)&w = (hx & 0x8000000000000000ull) |
-            ((long long)ny << 52) | (ix & 0x000fffffffffffffll);
+
+        *(long long *) &w = (hx & 0x8000000000000000ull) | ((long long)ny <<
+            52) | (ix & 0x000fffffffffffffll);
         return (w);
 }