Skip to content

Commit

Permalink
refactor: use utility to resolve offset
Browse files Browse the repository at this point in the history
  • Loading branch information
kgryte committed Jul 6, 2024
1 parent 9bd72c5 commit 341533b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
4 changes: 3 additions & 1 deletion lib/node_modules/@stdlib/strided/base/dmap/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
],
"libraries": [],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/strided/base/stride2offset"
]
}
]
}
13 changes: 3 additions & 10 deletions lib/node_modules/@stdlib/strided/base/dmap/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include "stdlib/strided/base/dmap.h"
#include "stdlib/strided/base/stride2offset.h"
#include <stdint.h>

/**
Expand Down Expand Up @@ -51,16 +52,8 @@ void stdlib_strided_dmap( const int64_t N, const double *X, const int64_t stride
if ( N <= 0 ) {
return;
}
if ( strideX < 0 ) {
ix = (1-N) * strideX;
} else {
ix = 0;
}
if ( strideY < 0 ) {
iy = (1-N) * strideY;
} else {
iy = 0;
}
ix = stdlib_strided_stride2offset( N, strideX );
iy = stdlib_strided_stride2offset( N, strideY );
for ( i = 0; i < N; i++ ) {
Y[ iy ] = fcn( X[ ix ] );
ix += strideX;
Expand Down

0 comments on commit 341533b

Please sign in to comment.