Fixed #773 blas_quickdivide bug on CMake and Visual Studio x86 32-bit.
This commit is contained in:
parent
0e68beb89f
commit
a1a96589aa
2
common.h
2
common.h
|
@ -411,7 +411,7 @@ please https://github.com/xianyi/OpenBLAS/issues/246
|
||||||
#ifndef ASSEMBLER
|
#ifndef ASSEMBLER
|
||||||
#ifdef OS_WINDOWS
|
#ifdef OS_WINDOWS
|
||||||
typedef char env_var_t[MAX_PATH];
|
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
|
#else
|
||||||
typedef char* env_var_t;
|
typedef char* env_var_t;
|
||||||
#define readenv(p, n) ((p)=getenv(n))
|
#define readenv(p, n) ((p)=getenv(n))
|
||||||
|
|
13
common_x86.h
13
common_x86.h
|
@ -41,6 +41,10 @@
|
||||||
|
|
||||||
#ifndef ASSEMBLER
|
#ifndef ASSEMBLER
|
||||||
|
|
||||||
|
#ifdef C_MSVC
|
||||||
|
#include <intrin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MB
|
#define MB
|
||||||
#define WMB
|
#define WMB
|
||||||
|
|
||||||
|
@ -170,12 +174,13 @@ static __inline int blas_quickdivide(unsigned int x, unsigned int y){
|
||||||
|
|
||||||
if (y <= 1) return x;
|
if (y <= 1) return x;
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
|
result = x/y;
|
||||||
|
return result;
|
||||||
|
#else
|
||||||
|
|
||||||
y = blas_quick_divide_table[y];
|
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));
|
__asm__ __volatile__ ("mull %0" :"=d" (result) :"a"(x), "0" (y));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue