Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.3 KiB

  1. /* _LDtest function -- IEEE 754 version */
  2. #include "xmath.h"
  3. _STD_BEGIN
  4. #if _DLONG == 0
  5. _CRTIMP2 short __cdecl _LDtest(long double *px)
  6. { /* categorize *px -- 64-bit */
  7. return (_Dtest((double *)px));
  8. }
  9. #elif _DLONG == 1
  10. _CRTIMP2 short __cdecl _LDtest(long double *px)
  11. { /* categorize *px -- 80-bit */
  12. unsigned short *ps = (unsigned short *)px;
  13. short xchar = ps[_L0] & _LMASK;
  14. if (xchar == _LMAX)
  15. return ((ps[_L1] & 0x7fff) != 0 || ps[_L2] != 0
  16. || ps[_L3] != 0 || ps[_L4] != 0 ? _NANCODE : _INFCODE);
  17. else if (0 < xchar || ps[_L1] != 0 || ps[_L2] || ps[_L3]
  18. || ps[_L4])
  19. return (_FINITE);
  20. else
  21. return (0);
  22. }
  23. #else /* 1 < _DLONG */
  24. _CRTIMP2 short __cdecl _LDtest(long double *px)
  25. { /* categorize *px -- 128-bit SPARC */
  26. unsigned short *ps = (unsigned short *)px;
  27. short xchar = ps[_L0] & _LMASK;
  28. if (xchar == _LMAX)
  29. return (ps[_L1] != 0 || ps[_L2] != 0 || ps[_L3] != 0
  30. || ps[_L4] != 0 || ps[_L5] != 0 || ps[_L6] != 0
  31. || ps[_L7] != 0 ? _NANCODE : _INFCODE);
  32. else if (0 < xchar || ps[_L1] || ps[_L2] || ps[_L3]
  33. || ps[_L4] || ps[_L5] || ps[_L6] || ps[_L7])
  34. return (_FINITE);
  35. else
  36. return (0);
  37. }
  38. #endif
  39. _STD_END
  40. /*
  41. * Copyright (c) 1992-2001 by P.J. Plauger. ALL RIGHTS RESERVED.
  42. * Consult your license regarding permissions and restrictions.
  43. V3.10:0009 */