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

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libm/common/m9x/modf.c
          +++ new/usr/src/lib/libm/common/m9x/modf.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  24   24   */
       25 +
  25   26  /*
  26   27   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  27   28   * Use is subject to license terms.
  28   29   */
  29   30  
  30   31  #pragma weak modf = __modf
  31   32  #pragma weak _modf = __modf
  32   33  
  33   34  /*
  34   35   * modf(x, iptr) decomposes x into an integral part and a fractional
↓ open down ↓ 3 lines elided ↑ open up ↑
  38   39   * If x is infinite, modf sets *iptr to x and returns copysign(0.0,x).
  39   40   * If x is NaN, modf sets *iptr to x and returns x.
  40   41   *
  41   42   * If x is a signaling NaN, this code does not attempt to raise the
  42   43   * invalid operation exception.
  43   44   */
  44   45  
  45   46  #include "libm.h"
  46   47  
  47   48  double
  48      -__modf(double x, double *iptr) {
       49 +__modf(double x, double *iptr)
       50 +{
  49   51          union {
  50   52                  unsigned i[2];
  51   53                  double d;
  52   54          } xx, yy;
       55 +
  53   56          unsigned hx, s;
  54   57  
  55   58          xx.d = x;
  56   59          hx = xx.i[HIWORD] & ~0x80000000;
  57   60  
  58      -        if (hx >= 0x43300000) { /* x is NaN, infinite, or integral */
       61 +        if (hx >= 0x43300000) {         /* x is NaN, infinite, or integral */
  59   62                  *iptr = x;
  60      -                if (hx < 0x7ff00000 || (hx == 0x7ff00000 &&
  61      -                        xx.i[LOWORD] == 0)) {
       63 +
       64 +                if (hx < 0x7ff00000 || (hx == 0x7ff00000 && xx.i[LOWORD] ==
       65 +                    0)) {
  62   66                          xx.i[HIWORD] &= 0x80000000;
  63   67                          xx.i[LOWORD] = 0;
  64   68                  }
       69 +
  65   70                  return (xx.d);
  66   71          }
  67   72  
  68      -        if (hx < 0x3ff00000) {  /* |x| < 1 */
       73 +        if (hx < 0x3ff00000) {          /* |x| < 1 */
  69   74                  xx.i[HIWORD] &= 0x80000000;
  70   75                  xx.i[LOWORD] = 0;
  71   76                  *iptr = xx.d;
  72   77                  return (x);
  73   78          }
  74   79  
  75   80          /* split x at the binary point */
  76   81          s = xx.i[HIWORD] & 0x80000000;
       82 +
  77   83          if (hx < 0x41400000) {
  78   84                  yy.i[HIWORD] = xx.i[HIWORD] & ~((1 << (0x413 - (hx >> 20))) -
  79      -                        1);
       85 +                    1);
  80   86                  yy.i[LOWORD] = 0;
  81   87          } else {
  82   88                  yy.i[HIWORD] = xx.i[HIWORD];
  83   89                  yy.i[LOWORD] = xx.i[LOWORD] & ~((1 << (0x433 - (hx >> 20))) -
  84      -                        1);
       90 +                    1);
  85   91          }
       92 +
  86   93          *iptr = yy.d;
  87   94          xx.d -= yy.d;
  88   95          xx.i[HIWORD] = (xx.i[HIWORD] & ~0x80000000) | s;
  89      -                                                        /* keep sign of x */
       96 +        /* keep sign of x */
  90   97          return (xx.d);
  91   98  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX