@@ -664,10 +664,10 @@ checkMatrixSizes(
664664 }
665665 }
666666
667- // 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
668- // 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.
669- // 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 ;
667+ // Calculates the memory required. Note that 'matrSize' already takes into account the fact that
668+ // there might be an unused tail, i.e. the elements between lda and M in the last column if
669+ // column major is used or between lda and N in the last row if row major is used.
670+ memUsed = offA + matrSize ;
671671 if (( memUsed > memSize ) || (offA + matrSize < offA )) {
672672 switch ( err )
673673 {
@@ -753,10 +753,10 @@ checkBandedMatrixSizes(
753753 }
754754 }
755755
756- // 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
757- // 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.
758- // 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 ;
756+ // Calculates the memory required. Note that 'matrSize' already takes into account the fact that
757+ // there might be an unused tail, i.e. the elements between lda and M in the last column if
758+ // column major is used or between lda and N in the last row if row major is used.
759+ memUsed = offA + matrSize ;
760760 if (memUsed > memSize ) {
761761 switch ( err )
762762 {
0 commit comments