Browse Source

Avoid taking root of negative number in symv_thread.c

This is similar to fixes in gh-1929, but there was one remaining
occurance of this type of pattern in the driver/level2/*_thread.c
files.
tags/v0.3.8^2
Sebastian Berg 6 years ago
parent
commit
6355c25dde
1 changed files with 7 additions and 3 deletions
  1. +7
    -3
      driver/level2/symv_thread.c

+ 7
- 3
driver/level2/symv_thread.c View File

@@ -166,7 +166,11 @@ int CNAME(BLASLONG m, FLOAT *alpha, FLOAT *a, BLASLONG lda, FLOAT *x, BLASLONG i
if (nthreads - num_cpu > 1) {

double di = (double)i;
width = ((BLASLONG)(sqrt(di * di + dnum) - di) + mask) & ~mask;
if (di * di - dnum > 0) {
width = ((BLASLONG)(-sqrt(di * di - dnum) + di) + mask) & ~mask;
} else {
width = m - i;
}

if (width < 4) width = 4;
if (width > m - i) width = m - i;
@@ -212,9 +216,9 @@ int CNAME(BLASLONG m, FLOAT *alpha, FLOAT *a, BLASLONG lda, FLOAT *x, BLASLONG i

double di = (double)(m - i);
if (di * di - dnum > 0) {
width = ((BLASLONG)(-sqrt(di * di - dnum) + di) + mask) & ~mask;
width = ((BLASLONG)(-sqrt(di * di - dnum) + di) + mask) & ~mask;
} else {
width = m - i;
width = m - i;
}

if (width < 4) width = 4;


Loading…
Cancel
Save