Skip to content

Commit 5b71c61

Browse files
committed
fix: create getters and setters cache variables
1 parent 2df0faf commit 5b71c61

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

lib/node_modules/@stdlib/ndarray/base/where/lib/0d.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
* // => <Float64Array>[ 1.0 ]
121121
*/
122122
function where0d( condition, x, y, out ) {
123-
out.data[ out.offset ] = ( condition.data[ condition.offset ] ) ? x.data[ x.offset ] : y.data[ y.offset ];
123+
out.data[ out.offset ] = ( condition.data[ condition.offset ] ) ? x.data[ x.offset ] : y.data[ y.offset ]; // eslint-disable-line max-len
124124
}
125125

126126

lib/node_modules/@stdlib/ndarray/base/where/lib/2d_accessors.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ function where2d( condition, x, y, out, isRowMajor ) {
145145
var xbuf;
146146
var ybuf;
147147
var obuf;
148+
var getc;
149+
var getx;
150+
var gety;
151+
var seto;
148152
var dc0;
149153
var dc1;
150154
var dx0;
@@ -213,15 +217,15 @@ function where2d( condition, x, y, out, isRowMajor ) {
213217
obuf = out.data;
214218

215219
// Cache accessors
220+
getc = condition.accessors[ 0 ];
216221
getx = x.accessors[ 0 ];
217222
gety = y.accessors[ 0 ];
218-
getc = condition.accessors[ 0 ];
219223
seto = out.accessors[ 1 ];
220224

221225
// Iterate over the ndarray dimensions...
222226
for ( i1 = 0; i1 < S1; i1++ ) {
223227
for ( i0 = 0; i0 < S0; i0++ ) {
224-
seto( obuf, io, ( getc( cbuf, ic ) ) ? getx( xbuf, ix ) : gety( ybuf, iy ) );
228+
seto( obuf, io, ( getc( cbuf, ic ) ) ? getx( xbuf, ix ) : gety( ybuf, iy ) ); // eslint-disable-line max-len
225229
ic += dc0;
226230
ix += dx0;
227231
iy += dy0;

lib/node_modules/@stdlib/ndarray/base/where/lib/2d_blocked.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ var blockSize = require( '@stdlib/ndarray/base/ternary-tiling-block-size' );
123123
* blockedwhere2d( condition, x, y, out );
124124
*
125125
* console.log( out.data );
126-
* // => <Float64Array>[ 2.0, 20.0, 30.0, 5.0 ]
126+
* // => <Float64Array>[ 2.0, 20.0, 30.0, 7.0 ]
127127
*/
128128
function blockedwhere2d( condition, x, y, out ) {
129129
var bsize;
@@ -167,7 +167,7 @@ function blockedwhere2d( condition, x, y, out ) {
167167
// Note on variable naming convention: s#, dc#, dx#, dy#, do#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...
168168

169169
// Resolve the loop interchange order:
170-
o = loopOrder( condition.shape, condition.strides, x.strides, y.strides, out.strides );
170+
o = loopOrder( condition.shape, condition.strides, x.strides, y.strides, out.strides ); // eslint-disable-line max-len
171171

172172
// Strides output as follows: sx, sy, sz, sw. According to arguments order respectively..
173173
sh = o.sh;

0 commit comments

Comments
 (0)