------- Comment #2 from ajrobb at bigfoot dot com  2007-04-29 19:51 -------
Thanks,
I'd forgotten that you can only alias through char* (or types related to the
operand).

Given that "A character type may alias any other type.",
I suppose I should be able to use (it works):

memcpy(&out->fraction, &value, 4);
memcpy(&out->mantissa, 4+(char*)&value, 4);
out->mantissa &= 0x7fffffff;

As all the elements are word aligned and the size is known, memcpy should get
inlined. The only slight disadvantage is that the final & operation is done
after storing out->mantissa and not before.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31734

Reply via email to