This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/32397] wrong instruction order generated
- From: "rask at sygehus dot dk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Jun 2007 11:27:15 -0000
- Subject: [Bug c/32397] wrong instruction order generated
- References: <bug-32397-14719@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from rask at sygehus dot dk 2007-06-19 11:27 -------
You can use memcpy (&int, &float, min (sizeof (int), sizeof (float))) and vice
versa. I suppose you can also memcpy() into or out of a char array of the right
size.
If you were to use the GCC extension of using a union, it would look something
like this:
double x;
cyg_uint32 hx, lx;
Cyg_libm_ieee_double_shape_type tmp;
tmp.value = x;
hx = tmp.parts.msw
lx = tmp.parts.lsw
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32397