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

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libm/common/R/logbf.c
          +++ new/usr/src/lib/libm/common/R/logbf.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 __logbf = logbf
  31   32  
  32   33  #include "libm.h"
  33      -#include "xpg6.h"       /* __xpg6 */
       34 +#include "xpg6.h"                       /* __xpg6 */
  34   35  #define _C99SUSv3_logb  _C99SUSv3_logb_subnormal_is_like_ilogb
  35   36  
  36   37  #if defined(__x86)
  37   38  static const float two25 = 33554432.0F;
  38   39  #else
  39   40  /*
  40   41   * v: a non-zero subnormal |x|
  41   42   */
  42   43  static int
  43      -ilogbf_subnormal(unsigned v) {
       44 +ilogbf_subnormal(unsigned v)
       45 +{
  44   46          int r = -126 - 23;
  45   47  
  46   48          if (v & 0xffff0000)
  47   49                  r += 16, v >>= 16;
       50 +
  48   51          if (v & 0xff00)
  49   52                  r += 8, v >>= 8;
       53 +
  50   54          if (v & 0xf0)
  51   55                  r += 4, v >>= 4;
       56 +
  52   57          v <<= 1;
  53   58          return (r + ((0xffffaa50 >> v) & 0x3));
  54   59  }
  55      -#endif  /* defined(__x86) */
       60 +#endif /* defined(__x86) */
  56   61  
  57   62  static float
  58      -raise_division(float t) {
       63 +raise_division(float t)
       64 +{
  59   65  #pragma STDC FENV_ACCESS ON
       66 +
  60   67          static const float zero = 0.0F;
       68 +
  61   69          return (t / zero);
  62   70  }
  63   71  
  64   72  float
  65      -logbf(float x) {
  66      -        int k = *((int *) &x) & ~0x80000000;
       73 +logbf(float x)
       74 +{
       75 +        int k = *((int *)&x) & ~0x80000000;
  67   76  
  68   77          if (k < 0x00800000) {
  69      -                if (k == 0)
       78 +                if (k == 0) {
  70   79                          return (raise_division(-1.0F));
  71      -                else if ((__xpg6 & _C99SUSv3_logb) != 0) {
       80 +                } else if ((__xpg6 & _C99SUSv3_logb) != 0) {
  72   81  #if defined(__x86)
  73   82                          x *= two25;
  74      -                        return ((float) (((*((int *) &x) & 0x7f800000) >> 23) -
  75      -                                152));
       83 +                        return ((float)(((*((int *)&x) & 0x7f800000) >> 23) -
       84 +                            152));
  76   85  #else
  77      -                        return ((float) ilogbf_subnormal(k));
       86 +                        return ((float)ilogbf_subnormal(k));
  78   87  #endif
  79      -                } else
       88 +                } else {
  80   89                          return (-126.F);
  81      -        } else if (k < 0x7f800000)
  82      -                return ((float) ((k >> 23) - 127));
  83      -        else
       90 +                }
       91 +        } else if (k < 0x7f800000) {
       92 +                return ((float)((k >> 23) - 127));
       93 +        } else {
  84   94                  return (x * x);
       95 +        }
  85   96  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX