extendhfsf2.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* Software floating-point emulation.
  2. Return an IEEE half converted to IEEE single
  3. Copyright (C) 2021 Free Software Foundation, Inc.
  4. This file is part of the GNU C Library.
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. In addition to the permissions in the GNU Lesser General Public
  10. License, the Free Software Foundation gives you unlimited
  11. permission to link the compiled version of this file into
  12. combinations with other programs, and to distribute those
  13. combinations without any restriction coming from the use of this
  14. file. (The Lesser General Public License restrictions do apply in
  15. other respects; for example, they cover modification of the file,
  16. and distribution when not linked into a combine executable.)
  17. The GNU C Library is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. Lesser General Public License for more details.
  21. You should have received a copy of the GNU Lesser General Public
  22. License along with the GNU C Library; if not, see
  23. <http://www.gnu.org/licenses/>. */
  24. #define FP_NO_EXACT_UNDERFLOW
  25. #include "soft-fp.h"
  26. #include "half.h"
  27. #include "single.h"
  28. SFtype
  29. __extendhfsf2 (HFtype a)
  30. {
  31. FP_DECL_EX;
  32. FP_DECL_H (A);
  33. FP_DECL_S (R);
  34. SFtype r;
  35. FP_INIT_EXCEPTIONS;
  36. FP_UNPACK_RAW_H (A, a);
  37. FP_EXTEND (S, H, 1, 1, R, A);
  38. FP_PACK_RAW_S (r, R);
  39. FP_HANDLE_EXCEPTIONS;
  40. return r;
  41. }