Skip to content

Commit 341533b

Browse files
committed
refactor: use utility to resolve offset
1 parent 9bd72c5 commit 341533b

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

lib/node_modules/@stdlib/strided/base/dmap/manifest.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
],
3333
"libraries": [],
3434
"libpath": [],
35-
"dependencies": []
35+
"dependencies": [
36+
"@stdlib/strided/base/stride2offset"
37+
]
3638
}
3739
]
3840
}

lib/node_modules/@stdlib/strided/base/dmap/src/main.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
#include "stdlib/strided/base/dmap.h"
20+
#include "stdlib/strided/base/stride2offset.h"
2021
#include <stdint.h>
2122

2223
/**
@@ -51,16 +52,8 @@ void stdlib_strided_dmap( const int64_t N, const double *X, const int64_t stride
5152
if ( N <= 0 ) {
5253
return;
5354
}
54-
if ( strideX < 0 ) {
55-
ix = (1-N) * strideX;
56-
} else {
57-
ix = 0;
58-
}
59-
if ( strideY < 0 ) {
60-
iy = (1-N) * strideY;
61-
} else {
62-
iy = 0;
63-
}
55+
ix = stdlib_strided_stride2offset( N, strideX );
56+
iy = stdlib_strided_stride2offset( N, strideY );
6457
for ( i = 0; i < N; i++ ) {
6558
Y[ iy ] = fcn( X[ ix ] );
6659
ix += strideX;

0 commit comments

Comments
 (0)