From c66552d3d7d59a1adb9bb43e8a4bbcf3c0fc820b Mon Sep 17 00:00:00 2001 From: Abdul Kaium Date: Thu, 29 Oct 2026 20:33:56 +0600 Subject: [PATCH] feat: add `number/uint64/base/sub` --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/number/uint64/base/sub/README.md | 183 ++++++++++++++++++ .../uint64/base/sub/benchmark/benchmark.js | 130 +++++++++++++ .../number/uint64/base/sub/docs/repl.txt | 117 +++++++++++ .../uint64/base/sub/docs/types/index.d.ts | 130 +++++++++++++ .../number/uint64/base/sub/docs/types/test.ts | 113 +++++++++++ .../number/uint64/base/sub/examples/index.js | 48 +++++ .../number/uint64/base/sub/lib/assign.js | 58 ++++++ .../number/uint64/base/sub/lib/index.js | 55 ++++++ .../number/uint64/base/sub/lib/main.js | 62 ++++++ .../number/uint64/base/sub/lib/strided.js | 59 ++++++ .../number/uint64/base/sub/package.json | 65 +++++++ .../uint64/base/sub/test/test.assign.js | 86 ++++++++ .../number/uint64/base/sub/test/test.js | 44 +++++ .../number/uint64/base/sub/test/test.main.js | 113 +++++++++++ .../uint64/base/sub/test/test.strided.js | 81 ++++++++ 15 files changed, 1344 insertions(+) create mode 100644 lib/node_modules/@stdlib/number/uint64/base/sub/README.md create mode 100644 lib/node_modules/@stdlib/number/uint64/base/sub/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/number/uint64/base/sub/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/number/uint64/base/sub/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/number/uint64/base/sub/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/number/uint64/base/sub/examples/index.js create mode 100644 lib/node_modules/@stdlib/number/uint64/base/sub/lib/assign.js create mode 100644 lib/node_modules/@stdlib/number/uint64/base/sub/lib/index.js create mode 100644 lib/node_modules/@stdlib/number/uint64/base/sub/lib/main.js create mode 100644 lib/node_modules/@stdlib/number/uint64/base/sub/lib/strided.js create mode 100644 lib/node_modules/@stdlib/number/uint64/base/sub/package.json create mode 100644 lib/node_modules/@stdlib/number/uint64/base/sub/test/test.assign.js create mode 100644 lib/node_modules/@stdlib/number/uint64/base/sub/test/test.js create mode 100644 lib/node_modules/@stdlib/number/uint64/base/sub/test/test.main.js create mode 100644 lib/node_modules/@stdlib/number/uint64/base/sub/test/test.strided.js diff --git a/lib/node_modules/@stdlib/number/uint64/base/sub/README.md b/lib/node_modules/@stdlib/number/uint64/base/sub/README.md new file mode 100644 index 000000000000..f405d47216ff --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/sub/README.md @@ -0,0 +1,183 @@ + + +# sub + +> Subtract two 64-bit unsigned integers. + +
+ +
+ + + +
+ +## Usage + +```javascript +var sub = require( '@stdlib/number/uint64/base/sub' ); +``` + +#### sub( a, b ) + +Subtracts two 64-bit unsigned integers. + +```javascript +var Uint64 = require( '@stdlib/number/uint64/ctor' ); + +var a = new Uint64( 10 ); +var b = new Uint64( 5 ); + +var v = sub( a, b ); +// returns [ 5n ] +``` + +#### sub.assign( ah, al, bh, bl, out, stride, offset ) + +Subtracts two 64-bit unsigned integers and assigns results to a provided output array. + +```javascript +var Uint32Array = require( '@stdlib/array/uint32' ); + +var out = new Uint32Array( 2 ); +var v = sub.assign( 0, 10, 0, 5, out, 1, 0 ); +// returns [ 0, 5 ] + +var bool = ( out === v ); +// returns true +``` + +The function supports the following parameters: + +- **ah**: high 32-bit word of the first 64-bit unsigned integer. +- **al**: low 32-bit word of the first 64-bit unsigned integer. +- **bh**: high 32-bit word of the second 64-bit unsigned integer. +- **bl**: low 32-bit word of the second 64-bit unsigned integer. +- **out**: output array. +- **stride**: stride length for `out`. +- **offset**: starting index for `out`. + +#### sub.strided( a, sa, oa, b, sb, ob, out, so, oo ) + +Subtracts two 64-bit unsigned integers stored in integer-valued strided array views and assigns results to a provided strided output array. + +```javascript +var Uint32Array = require( '@stdlib/array/uint32' ); + +var a = new Uint32Array( [ 0, 10 ] ); +var b = new Uint32Array( [ 0, 5 ] ); +var out = new Uint32Array( 2 ); + +var v = sub.strided( a, 1, 0, b, 1, 0, out, 1, 0 ); +// returns [ 0, 5 ] + +var bool = ( out === v ); +// returns true +``` + +The function supports the following parameters: + +- **a**: first 64-bit unsigned integer strided array view containing interleaved 32-bit unsigned integer high and low order words. +- **sa**: stride length for `a`. +- **oa**: starting index for `a`. +- **b**: second 64-bit unsigned integer strided array view containing interleaved 32-bit unsigned integer high and low order words. +- **sb**: stride length for `b`. +- **ob**: starting index for `b`. +- **out**: output array. +- **so**: stride length for `out`. +- **oo**: starting index for `out`. + +
+ + + + + +
+ +## Notes + +- When `b` is greater than `a`, the operation wraps around modulo `2^64` (i.e., `a - b + 2^64`). + +
+ + + +
+ +## Examples + + + +```javascript +var Uint64 = require( '@stdlib/number/uint64/ctor' ); +var sub = require( '@stdlib/number/uint64/base/sub' ); + +// Subtraction beyond JavaScript's safe integer limit (10^18 > 2^53 - 1): +var a = new Uint64( 1e18 ); +var b = new Uint64( 1 ); +var v = sub( a, b ); +console.log( '%s - %s = %s', a.toString(), b.toString(), v.toString() ); +// => '1000000000000000000 - 1 = 999999999999999999' + +a = new Uint64( 1e18 ); +b = new Uint64( 2 ); +v = sub( a, b ); +console.log( '%s - %s = %s', a.toString(), b.toString(), v.toString() ); +// => '1000000000000000000 - 2 = 999999999999999998' + +// Modular underflow wrap-around (modulo 2^64): +a = new Uint64( 0 ); +b = new Uint64( 1 ); +v = sub( a, b ); +console.log( '%s - %s = %s', a.toString(), b.toString(), v.toString() ); +// => '0 - 1 = 18446744073709551615' + +a = new Uint64( 5 ); +b = new Uint64( 10 ); +v = sub( a, b ); +console.log( '%s - %s = %s', a.toString(), b.toString(), v.toString() ); +// => '5 - 10 = 18446744073709551611' +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/number/uint64/base/sub/benchmark/benchmark.js b/lib/node_modules/@stdlib/number/uint64/base/sub/benchmark/benchmark.js new file mode 100644 index 000000000000..97df0a96f008 --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/sub/benchmark/benchmark.js @@ -0,0 +1,130 @@ +/** +* @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 Uint32Array = require( '@stdlib/array/uint32' ); +var bench = require( '@stdlib/bench' ); +var UINT32_MAX = require( '@stdlib/constants/uint32/max' ); +var Uint64 = require( '@stdlib/number/uint64/ctor' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var sub = require( './../lib' ); + + +// VARIABLES // + +var options = { + 'dtype': 'uint32' +}; + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var N; + var x; + var y; + var z; + var i; + + N = 100; + x = discreteUniform( N, 0, UINT32_MAX, options ); + values = []; + for ( i = 0; i < N; i++ ) { + values.push( Uint64.of( x[ i ], x[ (i+1)%N ] ) ); + } + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = values[ i%N ]; + z = values[ (i+1)%N ]; + out = sub( y, z ); + if ( typeof out !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( !( out instanceof Uint64 ) ) { + b.fail( 'should return a Uint64 instance' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( format( '%s:assign', pkg ), function benchmark( b ) { + var out; + var N; + var x; + var i; + + N = 100; + x = discreteUniform( N, 0, UINT32_MAX, options ); + + out = new Uint32Array( 2 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + // eslint-disable-next-line max-len + out = sub.assign( x[ i%N ], x[ (i+1)%N ], x[ (i+2)%N ], x[ (i+3)%N ], out, 1, 0 ); + if ( typeof out !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( !( out instanceof Uint32Array ) ) { + b.fail( 'should return a Uint32Array' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( format( '%s:strided', pkg ), function benchmark( b ) { + var out; + var N; + var x; + var y; + var i; + var j; + + N = 50; + x = discreteUniform( N*2, 0, UINT32_MAX, options ); + y = discreteUniform( N*2, 0, UINT32_MAX, options ); + + out = new Uint32Array( 2 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + j = ( i % N ) * 2; + out = sub.strided( x, 1, j, y, 1, j, out, 1, 0 ); + if ( typeof out !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( !( out instanceof Uint32Array ) ) { + b.fail( 'should return a Uint32Array' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/number/uint64/base/sub/docs/repl.txt b/lib/node_modules/@stdlib/number/uint64/base/sub/docs/repl.txt new file mode 100644 index 000000000000..078529288cb4 --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/sub/docs/repl.txt @@ -0,0 +1,117 @@ + +{{alias}}( a, b ) + Subtracts two 64-bit unsigned integers. + + Parameters + ---------- + a: Uint64 + 64-bit unsigned integer. + + b: Uint64 + 64-bit unsigned integer. + + Returns + ------- + out: Uint64 + Result. + + Examples + -------- + > var a = new {{alias:@stdlib/number/uint64/ctor}}( 10 ) + [ 10n ] + > var b = new {{alias:@stdlib/number/uint64/ctor}}( 5 ) + [ 5n ] + > var out = {{alias}}( a, b ) + [ 5n ] + + +{{alias}}.assign( ah, al, bh, bl, out, stride, offset ) + Subtracts two 64-bit unsigned integers and assigns results to a provided + output array. + + Parameters + ---------- + ah: integer + High 32-bit word of the first 64-bit unsigned integer. + + al: integer + Low 32-bit word of the first 64-bit unsigned integer. + + bh: integer + High 32-bit word of the second 64-bit unsigned integer. + + bl: integer + Low 32-bit word of the second 64-bit unsigned integer. + + out: ArrayLikeObject + Output array. + + stride: integer + Stride length. + + offset: integer + Starting index. + + Returns + ------- + out: ArrayLikeObject + Output array. + + Examples + -------- + > var out = new {{alias:@stdlib/array/uint32}}( 2 ); + > {{alias}}.assign( 0, 10, 0, 5, out, 1, 0 ) + [ 0, 5 ] + + +{{alias}}.strided( a, sa, oa, b, sb, ob, out, so, oo ) + Subtracts two 64-bit unsigned integers stored in integer-valued strided + array views and assigns results to a provided strided output array. + + Parameters + ---------- + a: ArrayLikeObject + First 64-bit unsigned integer strided array view containing interleaved + 32-bit unsigned integer high and low order words. + + sa: integer + Stride length for `a`. + + oa: integer + Starting index for `a`. + + b: ArrayLikeObject + Second 64-bit unsigned integer strided array view containing interleaved + 32-bit unsigned integer high and low order words. + + sb: integer + Stride length for `b`. + + ob: integer + Starting index for `b`. + + out: ArrayLikeObject + Output array. + + so: integer + Stride length for `out`. + + oo: integer + Starting index for `out`. + + Returns + ------- + out: ArrayLikeObject + Output array. + + Examples + -------- + > var a = new {{alias:@stdlib/array/uint32}}( [ 0, 10 ] ); + > var b = new {{alias:@stdlib/array/uint32}}( [ 0, 5 ] ); + > var out = new {{alias:@stdlib/array/uint32}}( 2 ); + > {{alias}}.strided( a, 1, 0, b, 1, 0, out, 1, 0 ) + [ 0, 5 ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/number/uint64/base/sub/docs/types/index.d.ts b/lib/node_modules/@stdlib/number/uint64/base/sub/docs/types/index.d.ts new file mode 100644 index 000000000000..9f326d9edbeb --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/sub/docs/types/index.d.ts @@ -0,0 +1,130 @@ +/* +* @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. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Uint64 } from '@stdlib/types/number'; +import { Collection, NumericArray } from '@stdlib/types/array'; + +/** +* Interface for subtracting two 64-bit unsigned integers. +*/ +interface Sub { + /** + * Subtracts two 64-bit unsigned integers. + * + * @param a - 64-bit unsigned integer + * @param b - 64-bit unsigned integer + * @returns result + * + * @example + * var Uint64 = require( '@stdlib/number/uint64/ctor' ); + * + * var a = new Uint64( 10 ); + * var b = new Uint64( 5 ); + * + * var v = sub( a, b ); + * // returns [ 5n ] + */ + ( a: Uint64, b: Uint64 ): Uint64; + + /** + * Subtracts two 64-bit unsigned integers and assigns results to a provided output array. + * + * @param ah - high 32-bit word of the first 64-bit unsigned integer + * @param al - low 32-bit word of the first 64-bit unsigned integer + * @param bh - high 32-bit word of the second 64-bit unsigned integer + * @param bl - low 32-bit word of the second 64-bit unsigned integer + * @param out - output array + * @param stride - stride length + * @param offset - starting index + * @returns output array + * + * @example + * var Uint32Array = require( '@stdlib/array/uint32' ); + * + * var out = sub.assign( 0, 10, 0, 5, new Uint32Array( 2 ), 1, 0 ); + * // returns [ 0, 5 ] + */ + assign>( ah: number, al: number, bh: number, bl: number, out: T, stride: number, offset: number ): T; + + /** + * Subtracts two 64-bit unsigned integers stored in integer-valued strided array views and assigns results to a provided strided output array. + * + * @param a - first 64-bit unsigned integer strided array view containing interleaved 32-bit unsigned integer high and low order words + * @param sa - stride length for `a` + * @param oa - starting index for `a` + * @param b - second 64-bit unsigned integer strided array view containing interleaved 32-bit unsigned integer high and low order words + * @param sb - stride length for `b` + * @param ob - starting index for `b` + * @param out - output array + * @param so - stride length for `out` + * @param oo - starting index for `out` + * @returns output array + * + * @example + * var Uint32Array = require( '@stdlib/array/uint32' ); + * + * var a = new Uint32Array( [ 0, 10 ] ); + * var b = new Uint32Array( [ 0, 5 ] ); + * + * var out = sub.strided( a, 1, 0, b, 1, 0, new Uint32Array( 2 ), 1, 0 ); + * // returns [ 0, 5 ] + */ + strided, U extends NumericArray | Collection, V extends NumericArray | Collection>( a: T, sa: number, oa: number, b: U, sb: number, ob: number, out: V, so: number, oo: number ): V; +} + +/** +* Subtracts two 64-bit unsigned integers. +* +* @param a - 64-bit unsigned integer +* @param b - 64-bit unsigned integer +* @returns result +* +* @example +* var Uint64 = require( '@stdlib/number/uint64/ctor' ); +* +* var a = new Uint64( 10 ); +* var b = new Uint64( 5 ); +* +* var v = sub( a, b ); +* // returns [ 5n ] +* +* @example +* var Uint32Array = require( '@stdlib/array/uint32' ); +* +* var out = sub.assign( 0, 10, 0, 5, new Uint32Array( 2 ), 1, 0 ); +* // returns [ 0, 5 ] +* +* @example +* var Uint32Array = require( '@stdlib/array/uint32' ); +* +* var a = new Uint32Array( [ 0, 10 ] ); +* var b = new Uint32Array( [ 0, 5 ] ); +* +* var out = sub.strided( a, 1, 0, b, 1, 0, new Uint32Array( 2 ), 1, 0 ); +* // returns [ 0, 5 ] +*/ +declare var sub: Sub; + + +// EXPORTS // + +export = sub; diff --git a/lib/node_modules/@stdlib/number/uint64/base/sub/docs/types/test.ts b/lib/node_modules/@stdlib/number/uint64/base/sub/docs/types/test.ts new file mode 100644 index 000000000000..2e61874e7cac --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/sub/docs/types/test.ts @@ -0,0 +1,113 @@ +/* +* @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. +*/ + +import Uint64 = require( '@stdlib/number/uint64/ctor' ); +import sub = require( './index' ); + + +// TESTS // + +// The function returns a 64-bit unsigned integer... +{ + const a = new Uint64( 5 ); + + sub( a, a ); // $ExpectType Uint64 +} + +// The compiler throws an error if the function is provided a first argument which is not a 64-bit unsigned integer... +{ + const a = new Uint64( 5 ); + + sub( true, a ); // $ExpectError + sub( false, a ); // $ExpectError + sub( null, a ); // $ExpectError + sub( undefined, a ); // $ExpectError + sub( '5', a ); // $ExpectError + sub( [], a ); // $ExpectError + sub( {}, a ); // $ExpectError + sub( ( x: number ): number => x, a ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a 64-bit unsigned integer... +{ + const a = new Uint64( 5 ); + + sub( a, true ); // $ExpectError + sub( a, false ); // $ExpectError + sub( a, null ); // $ExpectError + sub( a, undefined ); // $ExpectError + sub( a, '5' ); // $ExpectError + sub( a, [] ); // $ExpectError + sub( a, {} ); // $ExpectError + sub( a, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const a = new Uint64( 5 ); + + sub(); // $ExpectError + sub( a ); // $ExpectError + sub( a, a, a ); // $ExpectError +} + +// Attached to main export is an `assign` method which returns a collection... +{ + const out = [ 0, 0 ]; + + sub.assign( 0, 10, 0, 5, out, 1, 0 ); // $ExpectType number[] +} + +// The compiler throws an error if the `assign` method is provided invalid arguments... +{ + const out = [ 0, 0 ]; + + sub.assign( '5', 10, 0, 5, out, 1, 0 ); // $ExpectError + sub.assign( 0, '10', 0, 5, out, 1, 0 ); // $ExpectError + sub.assign( 0, 10, '0', 5, out, 1, 0 ); // $ExpectError + sub.assign( 0, 10, 0, '5', out, 1, 0 ); // $ExpectError + sub.assign( 0, 10, 0, 5, 123, 1, 0 ); // $ExpectError + sub.assign( 0, 10, 0, 5, out, '1', 0 ); // $ExpectError + sub.assign( 0, 10, 0, 5, out, 1, '0' ); // $ExpectError +} + +// Attached to main export is a `strided` method which returns a collection... +{ + const a = [ 0, 10 ]; + const b = [ 0, 5 ]; + const out = [ 0, 0 ]; + + sub.strided( a, 1, 0, b, 1, 0, out, 1, 0 ); // $ExpectType number[] +} + +// The compiler throws an error if the `strided` method is provided invalid arguments... +{ + const a = [ 0, 10 ]; + const b = [ 0, 5 ]; + const out = [ 0, 0 ]; + + sub.strided( 123, 1, 0, b, 1, 0, out, 1, 0 ); // $ExpectError + sub.strided( a, '1', 0, b, 1, 0, out, 1, 0 ); // $ExpectError + sub.strided( a, 1, '0', b, 1, 0, out, 1, 0 ); // $ExpectError + sub.strided( a, 1, 0, 123, 1, 0, out, 1, 0 ); // $ExpectError + sub.strided( a, 1, 0, b, '1', 0, out, 1, 0 ); // $ExpectError + sub.strided( a, 1, 0, b, 1, '0', out, 1, 0 ); // $ExpectError + sub.strided( a, 1, 0, b, 1, 0, 123, 1, 0 ); // $ExpectError + sub.strided( a, 1, 0, b, 1, 0, out, '1', 0 ); // $ExpectError + sub.strided( a, 1, 0, b, 1, 0, out, 1, '0' ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/number/uint64/base/sub/examples/index.js b/lib/node_modules/@stdlib/number/uint64/base/sub/examples/index.js new file mode 100644 index 000000000000..fd830c8a70ce --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/sub/examples/index.js @@ -0,0 +1,48 @@ +/** +* @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'; + +var Uint64 = require( '@stdlib/number/uint64/ctor' ); +var sub = require( './../lib' ); + +// Subtraction beyond JavaScript's safe integer limit (10^18 > 2^53 - 1): +var a = new Uint64( 1e18 ); +var b = new Uint64( 1 ); +var v = sub( a, b ); +console.log( '%s - %s = %s', a.toString(), b.toString(), v.toString() ); +// => '1000000000000000000 - 1 = 999999999999999999' + +a = new Uint64( 1e18 ); +b = new Uint64( 2 ); +v = sub( a, b ); +console.log( '%s - %s = %s', a.toString(), b.toString(), v.toString() ); +// => '1000000000000000000 - 2 = 999999999999999998' + +// Modular underflow wrap-around (modulo 2^64): +a = new Uint64( 0 ); +b = new Uint64( 1 ); +v = sub( a, b ); +console.log( '%s - %s = %s', a.toString(), b.toString(), v.toString() ); +// => '0 - 1 = 18446744073709551615' + +a = new Uint64( 5 ); +b = new Uint64( 10 ); +v = sub( a, b ); +console.log( '%s - %s = %s', a.toString(), b.toString(), v.toString() ); +// => '5 - 10 = 18446744073709551611' diff --git a/lib/node_modules/@stdlib/number/uint64/base/sub/lib/assign.js b/lib/node_modules/@stdlib/number/uint64/base/sub/lib/assign.js new file mode 100644 index 000000000000..14d4e49958fb --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/sub/lib/assign.js @@ -0,0 +1,58 @@ +/** +* @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'; + +// MAIN // + +/** +* Subtracts two 64-bit unsigned integers and assigns results to a provided output array. +* +* @param {uinteger} ah - high 32-bit word of the first 64-bit unsigned integer +* @param {uinteger} al - low 32-bit word of the first 64-bit unsigned integer +* @param {uinteger} bh - high 32-bit word of the second 64-bit unsigned integer +* @param {uinteger} bl - low 32-bit word of the second 64-bit unsigned integer +* @param {Collection} out - output array +* @param {integer} stride - stride length +* @param {NonNegativeInteger} offset - starting index +* @returns {Collection} output array +* +* @example +* var Uint32Array = require( '@stdlib/array/uint32' ); +* +* var out = assign( 0, 10, 0, 5, new Uint32Array( 2 ), 1, 0 ); +* // returns [ 0, 5 ] +*/ +function assign( ah, al, bh, bl, out, stride, offset ) { + var borrow; + + ah >>>= 0; + al >>>= 0; + bh >>>= 0; + bl >>>= 0; + + borrow = ( al < bl ) >>> 0; + out[ offset + stride ] = ( al - bl ) >>> 0; // lo + out[ offset ] = ( ah - bh - borrow ) >>> 0; // hi + return out; +} + + +// EXPORTS // + +module.exports = assign; diff --git a/lib/node_modules/@stdlib/number/uint64/base/sub/lib/index.js b/lib/node_modules/@stdlib/number/uint64/base/sub/lib/index.js new file mode 100644 index 000000000000..62ccf3b0624c --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/sub/lib/index.js @@ -0,0 +1,55 @@ +/** +* @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'; + +/** +* Subtract two 64-bit unsigned integers. +* +* @module @stdlib/number/uint64/base/sub +* +* @example +* var Uint64 = require( '@stdlib/number/uint64/ctor' ); +* var sub = require( '@stdlib/number/uint64/base/sub' ); +* +* var a = new Uint64( 10 ); +* var b = new Uint64( 5 ); +* +* var v = sub( a, b ); +* // returns [ 5n ] +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var main = require( './main.js' ); +var assign = require( './assign.js' ); +var strided = require( './strided.js' ); + + +// MAIN // + +setReadOnly( main, 'assign', assign ); +setReadOnly( main, 'strided', strided ); + + +// EXPORTS // + +module.exports = main; + +// exports: { "assign": "main.assign", "strided": "main.strided" } diff --git a/lib/node_modules/@stdlib/number/uint64/base/sub/lib/main.js b/lib/node_modules/@stdlib/number/uint64/base/sub/lib/main.js new file mode 100644 index 000000000000..25c66d2379d3 --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/sub/lib/main.js @@ -0,0 +1,62 @@ +/** +* @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 Uint32Array = require( '@stdlib/array/uint32' ); +var toWords = require( '@stdlib/number/uint64/base/to-words' ).assign; +var words2uint64 = require( '@stdlib/number/uint64/ctor' ).of; +var assign = require( './assign.js' ); + + +// VARIABLES // + +var WORKSPACE = new Uint32Array( 6 ); + + +// MAIN // + +/** +* Subtracts two 64-bit unsigned integers. +* +* @param {Uint64} a - 64-bit unsigned integer +* @param {Uint64} b - 64-bit unsigned integer +* @returns {Uint64} result +* +* @example +* var Uint64 = require( '@stdlib/number/uint64/ctor' ); +* +* var a = new Uint64( 10 ); +* var b = new Uint64( 5 ); +* +* var v = sub( a, b ); +* // returns [ 5n ] +*/ +function sub( a, b ) { + toWords( a, WORKSPACE, 1, 0 ); + toWords( b, WORKSPACE, 1, 2 ); + assign( WORKSPACE[ 0 ], WORKSPACE[ 1 ], WORKSPACE[ 2 ], WORKSPACE[ 3 ], WORKSPACE, 1, 4 ); // eslint-disable-line max-len + return words2uint64( WORKSPACE[ 4 ], WORKSPACE[ 5 ] ); +} + + +// EXPORTS // + +module.exports = sub; diff --git a/lib/node_modules/@stdlib/number/uint64/base/sub/lib/strided.js b/lib/node_modules/@stdlib/number/uint64/base/sub/lib/strided.js new file mode 100644 index 000000000000..7d08caa3dcdb --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/sub/lib/strided.js @@ -0,0 +1,59 @@ +/** +* @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 assign = require( './assign.js' ); + + +// MAIN // + +/** +* Subtracts two 64-bit unsigned integers stored in integer-valued strided array views and assigns results to a provided strided output array. +* +* @param {Collection} a - first 64-bit unsigned integer strided array view containing interleaved 32-bit unsigned integer high and low order words +* @param {integer} sa - stride length for `a` +* @param {NonNegativeInteger} oa - starting index for `a` +* @param {Collection} b - second 64-bit unsigned integer strided array view containing interleaved 32-bit unsigned integer high and low order words +* @param {integer} sb - stride length for `b` +* @param {NonNegativeInteger} ob - starting index for `b` +* @param {Collection} out - output array +* @param {integer} so - stride length for `out` +* @param {NonNegativeInteger} oo - starting index for `out` +* @returns {Collection} output array +* +* @example +* var Uint32Array = require( '@stdlib/array/uint32' ); +* +* var a = new Uint32Array( [ 0, 10 ] ); +* var b = new Uint32Array( [ 0, 5 ] ); +* +* var out = strided( a, 1, 0, b, 1, 0, new Uint32Array( 2 ), 1, 0 ); +* // returns [ 0, 5 ] +*/ +function strided( a, sa, oa, b, sb, ob, out, so, oo ) { + assign( a[ oa ], a[ oa+sa ], b[ ob ], b[ ob+sb ], out, so, oo ); + return out; +} + + +// EXPORTS // + +module.exports = strided; diff --git a/lib/node_modules/@stdlib/number/uint64/base/sub/package.json b/lib/node_modules/@stdlib/number/uint64/base/sub/package.json new file mode 100644 index 000000000000..24bfa9000df4 --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/sub/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/number/uint64/base/sub", + "version": "0.0.0", + "description": "Subtract two 64-bit unsigned integers.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "sub", + "sub64", + "subtraction", + "difference", + "arithmetic", + "unsigned", + "uint64", + "integer" + ] +} diff --git a/lib/node_modules/@stdlib/number/uint64/base/sub/test/test.assign.js b/lib/node_modules/@stdlib/number/uint64/base/sub/test/test.assign.js new file mode 100644 index 000000000000..15c1f7e3ee35 --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/sub/test/test.assign.js @@ -0,0 +1,86 @@ +/** +* @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 tape = require( 'tape' ); +var isEqualUint32Array = require( '@stdlib/assert/is-equal-uint32array' ); +var Uint32Array = require( '@stdlib/array/uint32' ); +var UINT32_MAX = require( '@stdlib/constants/uint32/max' ); +var sub = require( './../lib/assign.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof sub, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function subtracts two 64-bit unsigned integers', function test( t ) { + var expected; + var out; + var v; + + // Trivial stride and offset: + out = new Uint32Array( 2 ); + v = sub( 3, 4, 1, 2, out, 1, 0 ); + expected = new Uint32Array( [ 2, 2 ] ); + t.strictEqual( v, out, 'returns expected value' ); + t.ok( isEqualUint32Array( out, expected ), 'returns expected value' ); + + // Positive stride: + out = new Uint32Array( 4 ); + v = sub( 3, 4, 1, 2, out, 2, 0 ); + expected = new Uint32Array( [ 2, 0, 2, 0 ] ); + t.strictEqual( v, out, 'returns expected value' ); + t.ok( isEqualUint32Array( out, expected ), 'returns expected value' ); + + // Positive stride and non-zero offset: + out = new Uint32Array( 4 ); + v = sub( 3, 4, 1, 2, out, 2, 1 ); + expected = new Uint32Array( [ 0, 2, 0, 2 ] ); + t.strictEqual( v, out, 'returns expected value' ); + t.ok( isEqualUint32Array( out, expected ), 'returns expected value' ); + + // Negative stride and non-zero offset: + out = new Uint32Array( 2 ); + v = sub( 3, 4, 1, 2, out, -1, 1 ); + expected = new Uint32Array( [ 2, 2 ] ); + t.strictEqual( v, out, 'returns expected value' ); + t.ok( isEqualUint32Array( out, expected ), 'returns expected value' ); + + // 32-bit borrow: + out = new Uint32Array( 2 ); + v = sub( 1, 0, 0, 1, out, 1, 0 ); + expected = new Uint32Array( [ 0, UINT32_MAX ] ); + t.strictEqual( v, out, 'returns expected value' ); + t.ok( isEqualUint32Array( out, expected ), 'returns expected value' ); + + // 64-bit underflow (wraparound): + out = new Uint32Array( 2 ); + v = sub( 0, 0, 0, 1, out, 1, 0 ); + expected = new Uint32Array( [ UINT32_MAX, UINT32_MAX ] ); + t.strictEqual( v, out, 'returns expected value' ); + t.ok( isEqualUint32Array( out, expected ), 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/number/uint64/base/sub/test/test.js b/lib/node_modules/@stdlib/number/uint64/base/sub/test/test.js new file mode 100644 index 000000000000..e6338731bb19 --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/sub/test/test.js @@ -0,0 +1,44 @@ +/** +* @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 tape = require( 'tape' ); +var isMethod = require( '@stdlib/assert/is-method' ); +var sub = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof sub, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'attached to the main export is an `assign` method', function test( t ) { + t.strictEqual( isMethod( sub, 'assign' ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'attached to the main export is a `strided` method', function test( t ) { + t.strictEqual( isMethod( sub, 'strided' ), true, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/number/uint64/base/sub/test/test.main.js b/lib/node_modules/@stdlib/number/uint64/base/sub/test/test.main.js new file mode 100644 index 000000000000..81507a5e7730 --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/sub/test/test.main.js @@ -0,0 +1,113 @@ +/** +* @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 tape = require( 'tape' ); +var hasBigIntSupport = require( '@stdlib/assert/has-bigint-support' ); +var BigInt = require( '@stdlib/bigint/ctor' ); +var UINT32_MAX = require( '@stdlib/constants/uint32/max' ); +var isEqual = require( '@stdlib/number/uint64/base/assert/is-equal' ); +var Uint64 = require( '@stdlib/number/uint64/ctor' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var sub = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': !hasBigIntSupport() +}; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof sub, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function subtracts two 64-bit unsigned integers', function test( t ) { + var expected; + var out; + var a; + var b; + + // Small value: + a = new Uint64( 15 ); + b = new Uint64( 10 ); + out = sub( a, b ); + expected = new Uint64( 5 ); + t.ok( isEqual( out, expected ), 'returns expected value' ); + + // Same value: + a = new Uint64( 1000 ); + b = new Uint64( 1000 ); + out = sub( a, b ); + expected = new Uint64( 0 ); + t.ok( isEqual( out, expected ), 'returns expected value' ); + + // 32-bit borrow: + a = Uint64.of( 1, 0 ); + b = Uint64.of( 0, 1 ); + out = sub( a, b ); + expected = Uint64.of( 0, UINT32_MAX ); + t.ok( isEqual( out, expected ), 'returns expected value' ); + + // 64-bit underflow (wraparound): + a = new Uint64( 0 ); + b = new Uint64( 1 ); + out = sub( a, b ); + expected = Uint64.of( UINT32_MAX, UINT32_MAX ); + t.ok( isEqual( out, expected ), 'returns expected value' ); + + t.end(); +}); + +tape( 'the function subtracts two 64-bit unsigned integers (random values)', opts, function test( t ) { + var big64diff; + var expected; + var values; + var out; + var a; + var b; + var x; + var i; + + x = discreteUniform( 100, 0, UINT32_MAX, { + 'dtype': 'uint32' + }); + values = []; + for ( i = 0; i < x.length; i++ ) { + values.push( Uint64.of( x[ i ], x[ (i+1)%x.length ] ) ); + } + + for ( i = 0; i < values.length; i++ ) { + a = values[ i ]; + b = values[ (i+1)%values.length ]; + out = sub( a, b ); + big64diff = BigInt.asUintN( 64, a.valueOf() - b.valueOf() ); + expected = new Uint64( big64diff ); + t.ok( isEqual( out, expected ), 'returns expected value' ); + } + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/number/uint64/base/sub/test/test.strided.js b/lib/node_modules/@stdlib/number/uint64/base/sub/test/test.strided.js new file mode 100644 index 000000000000..e4943a88bc86 --- /dev/null +++ b/lib/node_modules/@stdlib/number/uint64/base/sub/test/test.strided.js @@ -0,0 +1,81 @@ +/** +* @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 tape = require( 'tape' ); +var isEqualUint32Array = require( '@stdlib/assert/is-equal-uint32array' ); +var Uint32Array = require( '@stdlib/array/uint32' ); +var sub = require( './../lib/strided.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof sub, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function subtracts two 64-bit unsigned integers', function test( t ) { + var expected; + var out; + var a; + var b; + var v; + + // Trivial stride and offset: + a = new Uint32Array( [ 3, 4 ] ); + b = new Uint32Array( [ 1, 2 ] ); + out = new Uint32Array( 2 ); + v = sub( a, 1, 0, b, 1, 0, out, 1, 0 ); + expected = new Uint32Array( [ 2, 2 ] ); + t.strictEqual( v, out, 'returns expected value' ); + t.ok( isEqualUint32Array( out, expected ), 'returns expected value' ); + + // Positive stride: + a = new Uint32Array( [ 3, 0, 0, 4, 0, 0 ] ); + b = new Uint32Array( [ 1, 0, 2, 0 ] ); + out = new Uint32Array( 2 ); + v = sub( a, 3, 0, b, 2, 0, out, 1, 0 ); + expected = new Uint32Array( [ 2, 2 ] ); + t.strictEqual( v, out, 'returns expected value' ); + t.ok( isEqualUint32Array( out, expected ), 'returns expected value' ); + + // Positive stride and non-zero offset: + a = new Uint32Array( [ 0, 0, 3, 0, 0, 4 ] ); + b = new Uint32Array( [ 0, 1, 0, 2 ] ); + out = new Uint32Array( 2 ); + v = sub( a, 3, 2, b, 2, 1, out, 1, 0 ); + expected = new Uint32Array( [ 2, 2 ] ); + t.strictEqual( v, out, 'returns expected value' ); + t.ok( isEqualUint32Array( out, expected ), 'returns expected value' ); + + // Negative stride and non-zero offset: + a = new Uint32Array( [ 0, 0, 4, 0, 0, 3 ] ); + b = new Uint32Array( [ 0, 2, 0, 1 ] ); + out = new Uint32Array( 2 ); + v = sub( a, -3, 5, b, -2, 3, out, 1, 0 ); + expected = new Uint32Array( [ 2, 2 ] ); + t.strictEqual( v, out, 'returns expected value' ); + t.ok( isEqualUint32Array( out, expected ), 'returns expected value' ); + + t.end(); +});