diff --git a/common.h b/common.h index 52f2402bb..6b65c37d1 100644 --- a/common.h +++ b/common.h @@ -411,7 +411,7 @@ please https://github.com/xianyi/OpenBLAS/issues/246 #ifndef ASSEMBLER #ifdef OS_WINDOWS typedef char env_var_t[MAX_PATH]; -#define readenv(p, n) GetEnvironmentVariable((n), (p), sizeof(p)) +#define readenv(p, n) GetEnvironmentVariable((LPCTSTR)(n), (LPTSTR)(p), sizeof(p)) #else typedef char* env_var_t; #define readenv(p, n) ((p)=getenv(n)) diff --git a/common_x86.h b/common_x86.h index 1ace84cad..ab9f22b0d 100644 --- a/common_x86.h +++ b/common_x86.h @@ -41,6 +41,10 @@ #ifndef ASSEMBLER +#ifdef C_MSVC +#include +#endif + #define MB #define WMB @@ -170,12 +174,13 @@ static __inline int blas_quickdivide(unsigned int x, unsigned int y){ if (y <= 1) return x; +#if defined(_MSC_VER) && !defined(__clang__) + result = x/y; + return result; +#else + y = blas_quick_divide_table[y]; -#if defined(_MSC_VER) && !defined(__clang__) - (void*)result; - return x*y; -#else __asm__ __volatile__ ("mull %0" :"=d" (result) :"a"(x), "0" (y)); return result;