d3dx9: Implement D3DXFloat16to32Array and D3DXFloat32to16Array.

Stefan Dösinger stefandoesinger at gmx.at
Fri Feb 11 15:20:10 CST 2011

Am Freitag 11 Februar 2011, 20:48:58 schrieb Misha Koshelev:

> +    if (*((unsigned int *)&in) == 0x00000000) return 0x0000;
> +    if (*((unsigned int *)&in) == 0x80000000) return 0x8000;
Thinking about it, there's something about this line that is not so nice: It 
relies on the actual encoding of the float, which may technically be platform 
specific if there's a CPU that implements non-IEEE- 754 floats.

You could try something like this(pseudo code, I removed the *s)

if(in == 0.0)
	if(sign(1.0 / in) == positive) return 0x0000;
	else return 0x8000;

The idea is that 1.0 / 0.0 returns Inf and 1.0 / -0.0 -Inf. I may be mistaken 
about that though.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20110211/c883e20e/attachment.pgp>

More information about the wine-devel mailing list