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


  41 #define INC(px) { \
  42                         if (++px[n3] == 0) \
  43                                 if (++px[n2] == 0) \
  44                                         if (++px[n1] == 0) \
  45                                                 ++px[n0]; \
  46                 }
  47 #define DEC(px) { \
  48                         if (--px[n3] == 0xffffffff) \
  49                                 if (--px[n2] == 0xffffffff) \
  50                                         if (--px[n1] == 0xffffffff) \
  51                                                 --px[n0]; \
  52                 }
  53 #elif defined(__x86)
  54 #define n0      2
  55 #define n1      1
  56 #define n2      0
  57 #define n3      0
  58 /*
  59  * if pseudo-denormal, replace by the equivalent normal
  60  */
  61 #define X86PDNRM1(x)    if (XBIASED_EXP(x) == 0 && (((int *) &x)[1] & \
  62                                 0x80000000) != 0) \
  63                                 ((int *) &x)[2] |= 1
  64 #define INC(px) { \
  65                         if (++px[n2] == 0) \
  66                                 if ((++px[n1] & ~0x80000000) == 0) \
  67                                         px[n1] = 0x80000000, ++px[n0]; \
  68                 }
  69 #define DEC(px) { \
  70                         if (--px[n2] == 0xffffffff) \
  71                                 if (--px[n1] == 0x7fffffff) \
  72                                         if ((--px[n0] & 0x7fff) != 0) \
  73                                                 px[n1] |= 0x80000000; \
  74                 }
  75 #endif
  76 
  77 long double
  78 nextafterl(long double x, long double y) {
  79         int *px = (int *) &x;
  80         int *py = (int *) &y;

  81 
  82         if (x == y)
  83                 return (y);             /* C99 requirement */
  84         if (x != x || y != y)
  85                 return (x * y);
  86 
  87         if (ISZEROL(x)) {       /* x == 0.0 */
  88                 px[n0] = py[n0] & XSGNMSK;
  89                 px[n1] = px[n2] = 0;
  90                 px[n3] = 1;
  91         } else {
  92                 X86PDNRM1(x);
  93                 if ((px[n0] & XSGNMSK) == 0) {      /* x > 0.0 */
  94                         if (x > y)   /* x > y */
  95                                 DEC(px)
  96                         else
  97                                 INC(px)
  98                 } else {
  99                         if (x < y)   /* x < y */
 100                                 DEC(px)


  41 #define INC(px) { \
  42                         if (++px[n3] == 0) \
  43                                 if (++px[n2] == 0) \
  44                                         if (++px[n1] == 0) \
  45                                                 ++px[n0]; \
  46                 }
  47 #define DEC(px) { \
  48                         if (--px[n3] == 0xffffffff) \
  49                                 if (--px[n2] == 0xffffffff) \
  50                                         if (--px[n1] == 0xffffffff) \
  51                                                 --px[n0]; \
  52                 }
  53 #elif defined(__x86)
  54 #define         n0      2
  55 #define         n1      1
  56 #define         n2      0
  57 #define         n3      0
  58 /*
  59  * if pseudo-denormal, replace by the equivalent normal
  60  */
  61 #define X86PDNRM1(x)    if (XBIASED_EXP(x) == 0 && (((int *)&x)[1] & \
  62                                 0x80000000) != 0) \
  63                                 ((int *)&x)[2] |= 1
  64 #define INC(px) { \
  65                         if (++px[n2] == 0) \
  66                                 if ((++px[n1] & ~0x80000000) == 0) \
  67                                         px[n1] = 0x80000000, ++px[n0]; \
  68                 }
  69 #define DEC(px) { \
  70                         if (--px[n2] == 0xffffffff) \
  71                                 if (--px[n1] == 0x7fffffff) \
  72                                         if ((--px[n0] & 0x7fff) != 0) \
  73                                                 px[n1] |= 0x80000000; \
  74                 }
  75 #endif
  76 
  77 long double
  78 nextafterl(long double x, long double y)
  79 {
  80         int *px = (int *)&x;
  81         int *py = (int *)&y;
  82 
  83         if (x == y)
  84                 return (y);             /* C99 requirement */
  85         if (x != x || y != y)
  86                 return (x * y);
  87 
  88         if (ISZEROL(x)) {       /* x == 0.0 */
  89                 px[n0] = py[n0] & XSGNMSK;
  90                 px[n1] = px[n2] = 0;
  91                 px[n3] = 1;
  92         } else {
  93                 X86PDNRM1(x);
  94                 if ((px[n0] & XSGNMSK) == 0) {      /* x > 0.0 */
  95                         if (x > y)   /* x > y */
  96                                 DEC(px)
  97                         else
  98                                 INC(px)
  99                 } else {
 100                         if (x < y)   /* x < y */
 101                                 DEC(px)