Skip to content

Commit 9b14e88

Browse files
committed
Updated the computation of the matrix-buffer memory used in case of no unused tail
1 parent 63ca259 commit 9b14e88

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/library/blas/generic/common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ checkMatrixSizes(
667667
// It is possible to allocate a buffer, and set up lda & ldb such that it looks like it will access outside of the allocated buffer, but if
668668
// M & N are kept small enough, no out of bounds access will occur. Compensate for the offset values and the unused tail memory caused by lda & ldb.
669669
// Ex: BuffSize=6 floats, M=1, N=2, lda=ldb=3, offA = 0, offB = 2 : |A[0,0]|unused|B[0,0]|A[0,1]|unused|B[0,1]|
670-
memUsed = (( offA + matrSize ) > unusedTail) ? offA + matrSize - unusedTail: 0;
670+
memUsed = (( offA + matrSize ) > unusedTail) ? offA + matrSize - unusedTail : offA + matrSize;
671671
if (( memUsed > memSize ) || (offA + matrSize < offA)) {
672672
switch( err )
673673
{
@@ -756,7 +756,7 @@ checkBandedMatrixSizes(
756756
// It is possible to allocate a buffer, and set up lda & ldb such that it looks like it will access outside of the allocated buffer, but if
757757
// M & N are kept small, no out of bounds access will occur. Compensate for the offset values and the unused tail memory caused by lda & ldb.
758758
// Ex: BuffSize=6 floats, M=1, N=2, lda=ldb=3, offA = 0, offB = 2 : |A[0,0]|unused|B[0,0]|A[0,1]|unused|B[0,1]|
759-
memUsed = (( offA + matrSize ) > unusedTail) ? offA + matrSize - unusedTail: 0;
759+
memUsed = (( offA + matrSize ) > unusedTail) ? offA + matrSize - unusedTail : offA + matrSize;
760760
if (memUsed > memSize) {
761761
switch( err )
762762
{

0 commit comments

Comments
 (0)