Skip to content

Commit e5c446c

Browse files
authored
Merge pull request #6280 from M-Colley/fix/quickdivide-64bit-truncation
common: fix 64-bit truncation and signed overflow in blas_quickdivide
2 parents 626d98d + 4f85e2d commit e5c446c

16 files changed

Lines changed: 34 additions & 22 deletions

‎common_arm.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static __inline void blas_lock(volatile BLASULONG *address){
7878
#endif
7979
#endif
8080

81-
static inline int blas_quickdivide(blasint x, blasint y){
81+
static inline BLASULONG blas_quickdivide(BLASULONG x, BLASULONG y){
8282
return x / y;
8383
}
8484

‎common_arm64.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static __inline BLASULONG rpcc(void){
128128
#define RPCC64BIT
129129
#endif
130130

131-
static inline int blas_quickdivide(blasint x, blasint y){
131+
static inline BLASULONG blas_quickdivide(BLASULONG x, BLASULONG y){
132132
return x / y;
133133
}
134134

‎common_csky.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4242
#ifndef ASSEMBLER
4343

4444

45-
static inline int blas_quickdivide(blasint x, blasint y){
45+
static inline BLASULONG blas_quickdivide(BLASULONG x, BLASULONG y){
4646
return x / y;
4747
}
4848

‎common_e2k.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4141
#define WMB do { __asm__ __volatile__("": : :"memory"); } while (0)
4242
#define RMB
4343

44-
static inline int blas_quickdivide(blasint x, blasint y) {
44+
static inline BLASULONG blas_quickdivide(BLASULONG x, BLASULONG y) {
4545
return x / y;
4646
}
4747

‎common_loongarch64.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7777

7878
#ifndef ASSEMBLER
7979

80-
static inline int blas_quickdivide(blasint x, blasint y){
80+
static inline BLASULONG blas_quickdivide(BLASULONG x, BLASULONG y){
8181
return x / y;
8282
}
8383

‎common_mips.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static inline unsigned int rpcc(void){
5454
#define RPCC_DEFINED
5555
#endif
5656

57-
static inline int blas_quickdivide(blasint x, blasint y){
57+
static inline BLASULONG blas_quickdivide(BLASULONG x, BLASULONG y){
5858
return x / y;
5959
}
6060

‎common_mips64.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static inline int WhereAmI(void){
109109
}
110110
#endif
111111

112-
static inline int blas_quickdivide(blasint x, blasint y){
112+
static inline BLASULONG blas_quickdivide(BLASULONG x, BLASULONG y){
113113
return x / y;
114114
}
115115

‎common_power.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ static inline unsigned long getstackaddr(void){
166166
#endif
167167

168168
#ifdef SMP
169-
static inline int blas_quickdivide(blasint x, blasint y){
169+
static inline BLASULONG blas_quickdivide(BLASULONG x, BLASULONG y){
170170
return x / y;
171171
}
172172
#endif

‎common_riscv64.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7878
#ifndef ASSEMBLER
7979

8080

81-
static inline int blas_quickdivide(blasint x, blasint y){
81+
static inline BLASULONG blas_quickdivide(BLASULONG x, BLASULONG y){
8282
return x / y;
8383
}
8484

‎common_sparc.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static __inline unsigned long rpcc(void){
9595
#define GET_IMAGE_CANCEL
9696

9797
#ifdef SMP
98-
static __inline int blas_quickdivide(blasint x, blasint y){
98+
static __inline BLASULONG blas_quickdivide(BLASULONG x, BLASULONG y){
9999
return x / y;
100100
}
101101
#endif

0 commit comments

Comments
 (0)