Browse Source

Fixed #773 blas_quickdivide bug on CMake and Visual Studio x86 32-bit.

tags/v0.2.16.rc1
Zhang Xianyi 9 years ago
parent
commit
a1a96589aa
2 changed files with 10 additions and 5 deletions
  1. +1
    -1
      common.h
  2. +9
    -4
      common_x86.h

+ 1
- 1
common.h View File

@@ -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))


+ 9
- 4
common_x86.h View File

@@ -41,6 +41,10 @@

#ifndef ASSEMBLER

#ifdef C_MSVC
#include <intrin.h>
#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;

y = blas_quick_divide_table[y];

#if defined(_MSC_VER) && !defined(__clang__)
(void*)result;
return x*y;
result = x/y;
return result;
#else

y = blas_quick_divide_table[y];

__asm__ __volatile__ ("mull %0" :"=d" (result) :"a"(x), "0" (y));

return result;


Loading…
Cancel
Save