isinfq.c 513 B

1234567891011121314151617181920212223242526
  1. /*
  2. * Written by J.T. Conklin <jtc@netbsd.org>.
  3. * Change for long double by Jakub Jelinek <jj@ultra.linux.cz>
  4. * Public domain.
  5. */
  6. #if defined(LIBM_SCCS) && !defined(lint)
  7. static char rcsid[] = "$NetBSD: $";
  8. #endif
  9. /*
  10. * isinfq(x) returns 1 if x is inf, -1 if x is -inf, else 0;
  11. * no branching!
  12. */
  13. #include "quadmath-imp.h"
  14. int
  15. isinfq (__float128 x)
  16. {
  17. int64_t hx,lx;
  18. GET_FLT128_WORDS64(hx,lx,x);
  19. lx |= (hx & 0x7fffffffffffffffLL) ^ 0x7fff000000000000LL;
  20. lx |= -lx;
  21. return ~(lx >> 63) & (hx >> 62);
  22. }