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

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libm/common/R/nextafterf.c
          +++ new/usr/src/lib/libm/common/R/nextafterf.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 __nextafterf = nextafterf
  31   32  
  32   33  #include "libm.h"
  33   34  
  34   35  float
  35      -nextafterf(float x, float y) {
       36 +nextafterf(float x, float y)
       37 +{
  36   38          float w;
  37      -        int *pw = (int *) &w;
  38      -        int *px = (int *) &x;
  39      -        int *py = (int *) &y;
       39 +        int *pw = (int *)&w;
       40 +        int *px = (int *)&x;
       41 +        int *py = (int *)&y;
  40   42          int ix, iy, iz;
  41   43  
  42   44          ix = px[0];
  43   45          iy = py[0];
       46 +
  44   47          if ((ix & ~0x80000000) > 0x7f800000)
  45   48                  return (x * y);         /* + -> * for Cheetah */
       49 +
  46   50          if ((iy & ~0x80000000) > 0x7f800000)
  47   51                  return (y * x);         /* + -> * for Cheetah */
       52 +
  48   53          if (ix == iy || (ix | iy) == 0x80000000)
  49   54                  return (y);             /* C99 requirement */
  50      -        if ((ix & ~0x80000000) == 0)
       55 +
       56 +        if ((ix & ~0x80000000) == 0) {
  51   57                  iz = 1 | (iy & 0x80000000);
  52      -        else if (ix > 0) {
       58 +        } else if (ix > 0) {
  53   59                  if (ix > iy)
  54   60                          iz = ix - 1;
  55   61                  else
  56   62                          iz = ix + 1;
  57   63          } else {
  58   64                  if (iy < 0 && ix < iy)
  59   65                          iz = ix + 1;
  60   66                  else
  61   67                          iz = ix - 1;
  62   68          }
       69 +
  63   70          pw[0] = iz;
  64   71          ix = iz & 0x7f800000;
       72 +
  65   73          if (ix == 0x7f800000) {
  66   74                  /* raise overflow */
  67   75                  volatile float t;
  68   76  
  69      -                *(int *) &t = 0x7f7fffff;
       77 +                *(int *)&t = 0x7f7fffff;
  70   78                  t *= t;
  71   79          } else if (ix == 0) {
  72   80                  /* raise underflow */
  73   81                  volatile float t;
  74   82  
  75      -                *(int *) &t = 0x00800000;
       83 +                *(int *)&t = 0x00800000;
  76   84                  t *= t;
  77   85          }
       86 +
  78   87          return (w);
  79   88  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX