floattitf.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* Software floating-point emulation.
  2. Convert a 128bit signed integer to IEEE quad
  3. Copyright (C) 2007-2019 Free Software Foundation, Inc.
  4. This file is part of the GNU C Library.
  5. Contributed by Uros Bizjak (ubizjak@gmail.com).
  6. The GNU C Library is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU Lesser General Public
  8. License as published by the Free Software Foundation; either
  9. version 2.1 of the License, or (at your option) any later version.
  10. In addition to the permissions in the GNU Lesser General Public
  11. License, the Free Software Foundation gives you unlimited
  12. permission to link the compiled version of this file into
  13. combinations with other programs, and to distribute those
  14. combinations without any restriction coming from the use of this
  15. file. (The Lesser General Public License restrictions do apply in
  16. other respects; for example, they cover modification of the file,
  17. and distribution when not linked into a combine executable.)
  18. The GNU C Library is distributed in the hope that it will be useful,
  19. but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  21. Lesser General Public License for more details.
  22. You should have received a copy of the GNU Lesser General Public
  23. License along with the GNU C Library; if not, see
  24. <http://www.gnu.org/licenses/>. */
  25. #include "soft-fp.h"
  26. #include "quad.h"
  27. TFtype
  28. __floattitf (TItype i)
  29. {
  30. FP_DECL_EX;
  31. FP_DECL_Q (A);
  32. TFtype a;
  33. FP_INIT_ROUNDMODE;
  34. FP_FROM_INT_Q (A, i, TI_BITS, UTItype);
  35. FP_PACK_RAW_Q (a, A);
  36. FP_HANDLE_EXCEPTIONS;
  37. return a;
  38. }