make blas_quickdivide unsigned and guard against miscompilation
This commit is contained in:
parent
0f9a935a5a
commit
0464e662ad
|
@ -80,7 +80,7 @@ static void __inline blas_lock(volatile BLASULONG *address){
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
do {
|
do {
|
||||||
while (*address) {YIELDING;};
|
while (*address) {YIELDING;}
|
||||||
|
|
||||||
#ifndef C_MSVC
|
#ifndef C_MSVC
|
||||||
__asm__ __volatile__(
|
__asm__ __volatile__(
|
||||||
|
@ -199,9 +199,9 @@ static __inline BLASLONG blas_quickdivide(BLASLONG x, BLASLONG y){
|
||||||
#else
|
#else
|
||||||
extern unsigned int blas_quick_divide_table[];
|
extern unsigned int blas_quick_divide_table[];
|
||||||
|
|
||||||
static __inline int blas_quickdivide(unsigned int x, unsigned int y){
|
static __inline unsigned int blas_quickdivide(unsigned int x, unsigned int y){
|
||||||
|
|
||||||
unsigned int result;
|
volatile unsigned int result;
|
||||||
|
|
||||||
if (y <= 1) return x;
|
if (y <= 1) return x;
|
||||||
|
|
||||||
|
@ -215,7 +215,6 @@ static __inline int blas_quickdivide(unsigned int x, unsigned int y){
|
||||||
y = blas_quick_divide_table[y];
|
y = blas_quick_divide_table[y];
|
||||||
|
|
||||||
__asm__ __volatile__ ("mull %0" :"=d" (result), "+a"(x) : "0" (y));
|
__asm__ __volatile__ ("mull %0" :"=d" (result), "+a"(x) : "0" (y));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue