Commit 27ca26bc authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

Detect whether Visual Studio can cast __uint64's to floats and disable

the relevant tests if it cannot. Fix a double to float literal conversion warning.
parent edc90a9f
...@@ -23,6 +23,25 @@ ...@@ -23,6 +23,25 @@
#include "oleauto.h" #include "oleauto.h"
#include <math.h> #include <math.h>
/* Some Visual C++ versions choke on __uint64 to float conversions.
* To fix this you need either VC++ 6.0 plus the processor pack
* or Visual C++ >=7.0.
*/
#ifndef _MSC_VER
# define HAS_UINT64_TO_FLOAT
#else
# if _MSC_VER >= 1300
# define HAS_UINT64_TO_FLOAT
# else
# include <malloc.h>
# if defined(_mm_free)
/* _mm_free is defined if the Processor Pack has been installed */
# define HAS_UINT64_TO_FLOAT
# endif
# endif
#endif
static HMODULE hOleaut32; static HMODULE hOleaut32;
#ifdef NONAMELESSUNION #ifdef NONAMELESSUNION
...@@ -2765,6 +2784,7 @@ static void test_VarR4Copy(void) ...@@ -2765,6 +2784,7 @@ static void test_VarR4Copy(void)
static void test_VarR4ChangeTypeEx(void) static void test_VarR4ChangeTypeEx(void)
{ {
#ifdef HAS_UINT64_TO_FLOAT
CONVVARS(CONV_TYPE); CONVVARS(CONV_TYPE);
VARIANTARG vSrc, vDst; VARIANTARG vSrc, vDst;
...@@ -2772,6 +2792,7 @@ static void test_VarR4ChangeTypeEx(void) ...@@ -2772,6 +2792,7 @@ static void test_VarR4ChangeTypeEx(void)
INITIAL_TYPETEST(VT_R4, V_R4, "%f"); INITIAL_TYPETEST(VT_R4, V_R4, "%f");
COMMON_TYPETEST; COMMON_TYPETEST;
#endif
} }
/* /*
...@@ -2972,6 +2993,7 @@ static void test_VarR8Copy(void) ...@@ -2972,6 +2993,7 @@ static void test_VarR8Copy(void)
static void test_VarR8ChangeTypeEx(void) static void test_VarR8ChangeTypeEx(void)
{ {
#ifdef HAS_UINT64_TO_FLOAT
CONVVARS(CONV_TYPE); CONVVARS(CONV_TYPE);
VARIANTARG vSrc, vDst; VARIANTARG vSrc, vDst;
...@@ -2979,6 +3001,7 @@ static void test_VarR8ChangeTypeEx(void) ...@@ -2979,6 +3001,7 @@ static void test_VarR8ChangeTypeEx(void)
INITIAL_TYPETEST(VT_R8, V_R8, "%g"); INITIAL_TYPETEST(VT_R8, V_R8, "%g");
COMMON_TYPETEST; COMMON_TYPETEST;
#endif
} }
#define MATHRND(l, r) left = l; right = r; hres = pVarR8Round(left, right, &out) #define MATHRND(l, r) left = l; right = r; hres = pVarR8Round(left, right, &out)
...@@ -3374,8 +3397,10 @@ static void test_VarDateChangeTypeEx(void) ...@@ -3374,8 +3397,10 @@ static void test_VarDateChangeTypeEx(void)
in = 1.0; in = 1.0;
#ifdef HAS_UINT64_TO_FLOAT
INITIAL_TYPETEST(VT_DATE, V_DATE, "%g"); INITIAL_TYPETEST(VT_DATE, V_DATE, "%g");
COMMON_TYPETEST; COMMON_TYPETEST;
#endif
V_VT(&vDst) = VT_EMPTY; V_VT(&vDst) = VT_EMPTY;
V_VT(&vSrc) = VT_DATE; V_VT(&vSrc) = VT_DATE;
...@@ -4527,7 +4552,7 @@ static void test_VarBstrFromR4(void) ...@@ -4527,7 +4552,7 @@ static void test_VarBstrFromR4(void)
CHECKPTR(VarBstrFromR4); CHECKPTR(VarBstrFromR4);
lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT); lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);
f = 654322.23456, f = 654322.23456f;
hres = pVarBstrFromR4(f, lcid, 0, &bstr); hres = pVarBstrFromR4(f, lcid, 0, &bstr);
ok(hres == S_OK, "got hres 0x%08lx\n", hres); ok(hres == S_OK, "got hres 0x%08lx\n", hres);
if (bstr) if (bstr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment