host-ieee32.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* This is a software decimal floating point library.
  2. Copyright (C) 2007-2013 Free Software Foundation, Inc.
  3. This file is part of GCC.
  4. GCC is free software; you can redistribute it and/or modify it under
  5. the terms of the GNU General Public License as published by the Free
  6. Software Foundation; either version 3, or (at your option) any later
  7. version.
  8. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  9. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  11. for more details.
  12. Under Section 7 of GPL version 3, you are granted additional
  13. permissions described in the GCC Runtime Library Exception, version
  14. 3.1, as published by the Free Software Foundation.
  15. You should have received a copy of the GNU General Public License and
  16. a copy of the GCC Runtime Library Exception along with this program;
  17. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  18. <http://www.gnu.org/licenses/>. */
  19. /* This implements IEEE 754R decimal floating point arithmetic, but
  20. does not provide a mechanism for setting the rounding mode, or for
  21. generating or handling exceptions. Conversions between decimal
  22. floating point types and other types depend on C library functions.
  23. Contributed by Ben Elliston <bje@au.ibm.com>. */
  24. /* The intended way to use this file is to make two copies, add `#define '
  25. to one copy, then compile both copies and add them to libgcc.a. */
  26. #include <string.h>
  27. #include "bid-dpd.h"
  28. #include "decimal32.h"
  29. void __host_to_ieee_32 (_Decimal32 in, decimal32 *out);
  30. void __ieee_to_host_32 (decimal32 in, _Decimal32 *out);
  31. void
  32. __host_to_ieee_32 (_Decimal32 in, decimal32 *out)
  33. {
  34. memcpy ((char *) out, (char *) &in, 4);
  35. }
  36. void
  37. __ieee_to_host_32 (decimal32 in, _Decimal32 *out)
  38. {
  39. memcpy ((char *) out, (char *) &in, 4);
  40. }