Skip to content

Commit 9bd72c5

Browse files
committed
refactor: use utility to resolve stride
1 parent c1da2d5 commit 9bd72c5

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

lib/node_modules/@stdlib/strided/base/cmap/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/cmap/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/cmap.h"
20+
#include "stdlib/strided/base/stride2offset.h"
2021
#include <stdint.h>
2122
#include <complex.h>
2223

@@ -55,16 +56,8 @@ void stdlib_strided_cmap( const int64_t N, const float complex *X, const int64_t
5556
if ( N <= 0 ) {
5657
return;
5758
}
58-
if ( strideX < 0 ) {
59-
ix = (1-N) * strideX;
60-
} else {
61-
ix = 0;
62-
}
63-
if ( strideY < 0 ) {
64-
iy = (1-N) * strideY;
65-
} else {
66-
iy = 0;
67-
}
59+
ix = stdlib_strided_stride2offset( N, strideX );
60+
iy = stdlib_strided_stride2offset( N, strideY );
6861
for ( i = 0; i < N; i++ ) {
6962
Y[ iy ] = fcn( X[ ix ] );
7063
ix += strideX;

0 commit comments

Comments
 (0)