wined3d: Fix build with MSVC (try 2).
Thomas Faber
thfabba at gmx.de
Mon Apr 30 08:26:30 CDT 2012
On 2012-04-29 12:05, Stefan Dösinger wrote:
> Am Samstag, 28. April 2012, 10:16:13 schrieb Thomas Faber:
>> Apparently NAN and INFINITE are C99 as well (I should really get a
>> version of the old standard instead of mostly reading C99 :|).
>>
>> How about a simple const variable that will trick MSVC, while not
>> changing semantics.
> How about a function in libs/port or a macro in one of its headers? I believe
> the NAN/INFINITE issue is not specific to wined3d.
>
> With the const variable, msvc compiles the code, but still produces a warning.
Ah, the warning appears only with optimization enabled, that's why I didn't
notice.
port sounds great - but (assuming there shouldn't be any "0x7fc00000" or
"#ifdef _MSC_VER" in the solution) the best I can come up with at the moment
is the following :|
#ifndef INFINITY
static float __infinity(int x)
{
const float zero = x ? 0.0f : 1.0f;
return 1.0f / zero;
}
# define INFINITY __infinity(1)
#endif
#ifndef NAN
static float __nan(int x)
{
const float zero = x ? 0.0f : 1.0f;
return zero / zero;
}
# define NAN __nan(1)
#endif
More information about the wine-devel
mailing list