Skip to content

Commit 9baa757

Browse files
authored
Update nrm2_vector.c
1 parent 18a6db6 commit 9baa757

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

kernel/riscv64/nrm2_vector.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ FLOAT CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x)
122122
unsigned int stride_x = inc_x * sizeof(FLOAT);
123123
int idx = 0;
124124

125-
if( n >= gvl ) // don't pay overheads if we're not doing useful work
125+
if( n >= gvl && inc_x > 0) // don't pay overheads if we're not doing useful work
126126
{
127127
for(i=0; i<n/gvl; i++){
128128
v0 = VLSEV_FLOAT( &x[idx], stride_x, gvl );
@@ -193,7 +193,7 @@ FLOAT CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x)
193193
//finish any tail using scalar ops
194194
i*=gvl*inc_x;
195195
n*=inc_x;
196-
while(i< n){
196+
while(abs(i)< abs(n)){
197197
if ( x[i] != 0.0 ){
198198
FLOAT absxi = ABS( x[i] );
199199
if ( scale < absxi ){

0 commit comments

Comments
 (0)