fsqrt.c 632 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include <linux/types.h>
  2. #include <linux/errno.h>
  3. #include <asm/uaccess.h>
  4. #include "soft-fp.h"
  5. #include "double.h"
  6. int
  7. fsqrt(void *frD, void *frB)
  8. {
  9. FP_DECL_D(B);
  10. FP_DECL_D(R);
  11. int ret = 0;
  12. #ifdef DEBUG
  13. printk("%s: %p %p %p %p\n", __FUNCTION__, frD, frB);
  14. #endif
  15. __FP_UNPACK_D(B, frB);
  16. #ifdef DEBUG
  17. printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
  18. #endif
  19. if (B_s && B_c != FP_CLS_ZERO)
  20. ret |= EFLAG_VXSQRT;
  21. if (B_c == FP_CLS_NAN)
  22. ret |= EFLAG_VXSNAN;
  23. FP_SQRT_D(R, B);
  24. #ifdef DEBUG
  25. printk("R: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
  26. #endif
  27. return (ret | __FP_PACK_D(frD, R));
  28. }