s_isnanf.c 815 B

123456789101112131415161718192021222324252627282930313233
  1. #include "SDL_internal.h"
  2. /* s_isnanf.c -- float version of s_isnan.c.
  3. * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
  4. */
  5. /*
  6. * ====================================================
  7. * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  8. *
  9. * Developed at SunPro, a Sun Microsystems, Inc. business.
  10. * Permission to use, copy, modify, and distribute this
  11. * software is freely granted, provided that this notice
  12. * is preserved.
  13. * ====================================================
  14. */
  15. /*
  16. * isnanf(x) returns 1 is x is nan, else 0;
  17. * no branching!
  18. */
  19. #include "math.h"
  20. #include "math_private.h"
  21. int __isnanf(float x)
  22. {
  23. int32_t ix;
  24. GET_FLOAT_WORD(ix,x);
  25. ix &= 0x7fffffff;
  26. ix = 0x7f800000 - ix;
  27. return (int)(((u_int32_t)(ix))>>31);
  28. }
  29. libm_hidden_def(__isnanf)