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

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libm/common/Q/rintl.c
          +++ new/usr/src/lib/libm/common/Q/rintl.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 __rintl = rintl
  31   32  
  32   33  /*
  33   34   * rintl(long double x) return x rounded to integral according to
  34   35   * the prevailing rounding direction
↓ open down ↓ 2 lines elided ↑ open up ↑
  37   38   * with the same sign as x's, including 0.0L.
  38   39   */
  39   40  
  40   41  #include "libm.h"
  41   42  #include "longdouble.h"
  42   43  
  43   44  extern enum fp_precision_type __swapRP(enum fp_precision_type);
  44   45  
  45   46  static const double one = 1.0;
  46   47  static const long double qzero = 0.0L;
  47      -
  48   48  long double
  49      -rintl(long double x) {
       49 +rintl(long double x)
       50 +{
  50   51          enum fp_precision_type rp;
  51   52          long double t, w, two112;
  52      -        int *pt = (int *) &two112;
       53 +        int *pt = (int *)&two112;
  53   54  
  54   55          if (!finitel(x))
  55   56                  return (x + x);
  56   57  
  57      -        if (*(int *) &one != 0) {       /* set two112 = 2^112 */
       58 +        if (*(int *)&one != 0) {        /* set two112 = 2^112 */
  58   59                  pt[0] = 0x406f0000;
  59   60                  pt[1] = pt[2] = pt[3] = 0;
  60   61          } else {
  61   62                  pt[3] = 0x406f0000;
  62   63                  pt[0] = pt[1] = pt[2] = 0;
  63   64          }
  64   65  
  65   66          if (fabsl(x) >= two112)
  66      -                return (x);     /* already an integer */
       67 +                return (x);                     /* already an integer */
       68 +
  67   69          t = copysignl(two112, x);
  68      -        rp = __swapRP(fp_extended);     /* make sure precision is long double */
  69      -        w = x + t;                      /* x+sign(x)*2^112 rounded to integer */
  70      -        (void) __swapRP(rp);            /* restore precision mode */
       70 +        rp = __swapRP(fp_extended); /* make sure precision is long double */
       71 +        w = x + t;                  /* x+sign(x)*2^112 rounded to integer */
       72 +        (void) __swapRP(rp);        /* restore precision mode */
       73 +
  71   74          if (w == t)
  72   75                  return (copysignl(qzero, x));   /* x rounded to zero */
  73   76          else
  74   77                  return (w - t);
  75   78  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX