[Interest] Byte Swapping float and double

Thiago Macieira thiago.macieira at intel.com
Sun Sep 8 00:19:29 CEST 2013


On sábado, 7 de setembro de 2013 15:41:37, Michael Jackson wrote:
> I'll plat the naive one here. What is the proper Qt API to byte swap a float
> or double? create a union? or some other such trick like that?

memcpy to a char buffer, byte swap.

DO NOT reload the swapped float or double into a variable of type float or 
double. After it's been swapped, it's just char[4] or char[8].

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130907/a93a5e1e/attachment.sig>


More information about the Interest mailing list