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

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libm/common/m9x/frexpl.c
          +++ new/usr/src/lib/libm/common/m9x/frexpl.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 frexpl = __frexpl
  31   32  
  32   33  #include "libm.h"
  33   34  
  34   35  #if defined(__sparc)
  35      -
  36   36  long double
  37      -__frexpl(long double x, int *exp) {
       37 +__frexpl(long double x, int *exp)
       38 +{
  38   39          union {
  39   40                  unsigned i[4];
  40   41                  long double q;
  41   42          } xx;
       43 +
  42   44          unsigned hx;
  43   45          int e, s;
  44   46  
  45   47          xx.q = x;
  46   48          hx = xx.i[0] & ~0x80000000;
  47   49  
  48      -        if (hx >= 0x7fff0000) { /* x is infinite or NaN */
       50 +        if (hx >= 0x7fff0000) {         /* x is infinite or NaN */
  49   51                  *exp = 0;
  50   52                  return (x);
  51   53          }
  52   54  
  53   55          e = 0;
  54      -        if (hx < 0x00010000) {  /* x is subnormal or zero */
       56 +
       57 +        if (hx < 0x00010000) {          /* x is subnormal or zero */
  55   58                  if ((hx | xx.i[1] | xx.i[2] | xx.i[3]) == 0) {
  56   59                          *exp = 0;
  57   60                          return (x);
  58   61                  }
  59   62  
  60   63                  /* normalize x */
  61   64                  s = xx.i[0] & 0x80000000;
       65 +
  62   66                  while ((hx | (xx.i[1] & 0xffff0000)) == 0) {
  63   67                          hx = xx.i[1];
  64   68                          xx.i[1] = xx.i[2];
  65   69                          xx.i[2] = xx.i[3];
  66   70                          xx.i[3] = 0;
  67   71                          e -= 32;
  68   72                  }
       73 +
  69   74                  while (hx < 0x10000) {
  70   75                          hx = (hx << 1) | (xx.i[1] >> 31);
  71   76                          xx.i[1] = (xx.i[1] << 1) | (xx.i[2] >> 31);
  72   77                          xx.i[2] = (xx.i[2] << 1) | (xx.i[3] >> 31);
  73   78                          xx.i[3] <<= 1;
  74   79                          e--;
  75   80                  }
       81 +
  76   82                  xx.i[0] = s | hx;
  77   83          }
  78   84  
  79   85          /* now xx.q is normal */
  80   86          xx.i[0] = (xx.i[0] & ~0x7fff0000) | 0x3ffe0000;
  81   87          *exp = e + (hx >> 16) - 0x3ffe;
  82   88          return (xx.q);
  83   89  }
  84      -
  85   90  #elif defined(__x86)
  86      -
  87   91  long double
  88      -__frexpl(long double x, int *exp) {
       92 +__frexpl(long double x, int *exp)
       93 +{
  89   94          union {
  90   95                  unsigned i[3];
  91   96                  long double e;
  92   97          } xx;
       98 +
  93   99          unsigned hx;
  94  100          int e;
  95  101  
  96  102          xx.e = x;
  97  103          hx = xx.i[2] & 0x7fff;
  98  104  
  99      -        if (hx >= 0x7fff) {     /* x is infinite or NaN */
      105 +        if (hx >= 0x7fff) {             /* x is infinite or NaN */
 100  106                  *exp = 0;
 101  107                  return (x);
 102  108          }
 103  109  
 104  110          e = 0;
 105      -        if (hx < 0x0001) {      /* x is subnormal or zero */
      111 +
      112 +        if (hx < 0x0001) {              /* x is subnormal or zero */
 106  113                  if ((xx.i[0] | xx.i[1]) == 0) {
 107  114                          *exp = 0;
 108  115                          return (x);
 109  116                  }
 110  117  
 111  118                  /* normalize x */
 112  119                  xx.e *= 18446744073709551616.0L;        /* 2^64 */
 113  120                  hx = xx.i[2] & 0x7fff;
 114  121                  e = -64;
 115  122          }
 116  123  
 117  124          /* now xx.e is normal */
 118  125          xx.i[2] = (xx.i[2] & 0x8000) | 0x3ffe;
 119  126          *exp = e + hx - 0x3ffe;
 120  127          return (xx.e);
 121  128  }
 122      -
 123  129  #else
 124  130  #error Unknown architecture
 125  131  #endif
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX