File tree 1 file changed +7
-2
lines changed
lib/node_modules/@stdlib/ndarray/base/assert/is-buffer-length-compatible/lib
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 23
23
var minmax = require ( '@stdlib/ndarray/base/minmax-view-buffer-index' ) ;
24
24
25
25
26
+ // VARIABLES //
27
+
28
+ var BUFFER = [ 0 , 0 ] ; // WARNING: in C, this would not be thread safe
29
+
30
+
26
31
// MAIN //
27
32
28
33
/**
@@ -52,10 +57,10 @@ var minmax = require( '@stdlib/ndarray/base/minmax-view-buffer-index' );
52
57
*/
53
58
function isBufferLengthCompatible ( len , shape , strides , offset ) {
54
59
// Determine the minimum and maximum linear indices which are accessible by the array view:
55
- var idx = minmax ( shape , strides , offset ) ;
60
+ minmax ( BUFFER , shape , strides , offset ) ;
56
61
57
62
// If the indices are "inbounds", then the buffer length is compatible:
58
- return ( idx [ 0 ] >= 0 && idx [ 1 ] < len ) ;
63
+ return ( BUFFER [ 0 ] >= 0 && BUFFER [ 1 ] < len ) ;
59
64
}
60
65
61
66
You can’t perform that action at this time.
0 commit comments