Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions lib/node_modules/@stdlib/array/uint64/lib/from_array.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2026 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var Uint64 = require( '@stdlib/number/uint64/ctor' );
var isUint64 = require( '@stdlib/assert/is-uint64' );
var indices = require( './indices.js' );


// MAIN //

/**
* Returns a strided array of high and low words..
*
* @private
* @param {Uint32Array} buf - output array
* @param {Array} arr - array containing 64-bit unsigned integers
* @returns {(Uint32Array|null)} output array or null
*/
function fromArray( buf, arr ) {
var len;
var v;
var i;
var j;

len = arr.length;
j = 0;
for ( i = 0; i < len; i++ ) {
v = arr[ i ];
if ( !isUint64( v ) ) {
v = new Uint64( v ); // delegate validation to the scalar constructor
}
buf[ j + indices.HIGH ] = v.hi;
buf[ j + indices.LOW ] = v.lo;
j += 2; // stride
}
return buf;
}


// EXPORTS //

module.exports = fromArray;
60 changes: 60 additions & 0 deletions lib/node_modules/@stdlib/array/uint64/lib/from_iterator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2026 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var format = require( '@stdlib/string/format' );

Check failure on line 23 in lib/node_modules/@stdlib/array/uint64/lib/from_iterator.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

'format' is assigned a value but never used
var isUint64 = require( '@stdlib/assert/is-uint64' );
var Uint64 = require( '@stdlib/number/uint64/ctor' );


// MAIN //

/**
* Returns an array of iterated values.
*
* @private
* @param {Object} it - iterator
* @returns {(Array|TypeError)} array or an error
*/
function fromIterator( it ) {
var out;
var v;
var z;

out = [];
while ( true ) {
v = it.next();
if ( v.done ) {
break;
}
z = v.value;
if ( !isUint64( z ) ) {
z = new Uint64( z );
}
out.push( z.hi, z.lo );
}
return out;
}


// EXPORTS //

module.exports = fromIterator;
65 changes: 65 additions & 0 deletions lib/node_modules/@stdlib/array/uint64/lib/from_iterator_map.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2026 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var format = require( '@stdlib/string/format' );
var isUint64 = require( '@stdlib/assert/is-uint64' );
var Uint64 = require( '@stdlib/number/uint64/ctor' );


// MAIN //

/**
* Returns an array of iterated values.
*
* @private
* @param {Object} it - iterator
* @param {Function} clbk - callback to invoke for each iterated value
* @param {*} thisArg - invocation context
* @returns {(Array|TypeError)} array or an error
*/
function fromIteratorMap( it, clbk, thisArg ) {
var out;
var v;
var z;
var i;

out = [];
i = -1;
while ( true ) {
v = it.next();
if ( v.done ) {
break;
}
i += 1;
z = clbk.call( thisArg, v.value, i );
if ( !isUint64( z ) ) {
z = new Uint64( z );
}

Check failure on line 56 in lib/node_modules/@stdlib/array/uint64/lib/from_iterator_map.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Trailing whitespace
out.push( z.hi, z.lo );
}
return out;
}


// EXPORTS //

module.exports = fromIteratorMap;
94 changes: 94 additions & 0 deletions lib/node_modules/@stdlib/array/uint64/lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2026 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

/**
* 64-bit unsigned integer array.
*
* @module @stdlib/array/uint64
*
* @example
* var Uint64Array = require( '@stdlib/array/uint64' );
*
* var arr = new Uint64Array();
* // returns <Uint64Array>
*
* var len = arr.length;
* // returns 0
*
* @example
* var Uint64Array = require( '@stdlib/array/uint64' );
*
* var arr = new Uint64Array( 2 );
* // returns <Uint64Array>
*
* var len = arr.length;
* // returns 2
*
* @example
* var Uint64Array = require( '@stdlib/array/uint64' );
*
* var arr = new Uint64Array( [ 1234, 5678 ] );
* // returns <Uint64Array>
*
* var len = arr.length;
* // returns 1
*
* @example
* var ArrayBuffer = require( '@stdlib/array/buffer' );
* var Uint64Array = require( '@stdlib/array/uint64' );
*
* var buf = new ArrayBuffer( 32 );
* var arr = new Uint64Array( buf );
* // returns <Uint64Array>
*
* var len = arr.length;
* // returns 4
*
* @example
* var ArrayBuffer = require( '@stdlib/array/buffer' );
* var Uint64Array = require( '@stdlib/array/uint64' );
*
* var buf = new ArrayBuffer( 32 );
* var arr = new Uint64Array( buf, 16 );
* // returns <Uint64Array>
*
* var len = arr.length;
* // returns 2
*
* @example
* var ArrayBuffer = require( '@stdlib/array/buffer' );
* var Uint64Array = require( '@stdlib/array/uint64' );
*
* var buf = new ArrayBuffer( 64 );
* var arr = new Uint64Array( buf, 16, 2 );
* // returns <Uint64Array>
*
* var len = arr.length;
* // returns 2
*/

// MODULES //

var main = require( './main.js' );


// EXPORTS //

module.exports = main;
47 changes: 47 additions & 0 deletions lib/node_modules/@stdlib/array/uint64/lib/indices.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2026 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var isLittleEndian = require( '@stdlib/assert/is-little-endian' );


// MAIN //

var indices;
var HIGH;
var LOW;

if ( isLittleEndian === true ) {
HIGH = 1; // second index
LOW = 0; // first index
} else {
HIGH = 0; // first index
LOW = 1; // second index
}
indices = {
'HIGH': HIGH,
'LOW': LOW
};


// EXPORTS //

module.exports = indices;
Loading
Loading