From fb7605f95987315b70e0610a45e445f1ba83bfc4 Mon Sep 17 00:00:00 2001 From: Divit Date: Wed, 5 Aug 2026 08:39:30 +0000 Subject: [PATCH 1/2] chore: clean up get method benchmark --- 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: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - 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: na - task: lint_license_headers status: passed --- --- .../@stdlib/array/uint64/benchmark/benchmark.get.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/array/uint64/benchmark/benchmark.get.js b/lib/node_modules/@stdlib/array/uint64/benchmark/benchmark.get.js index bee09657497b..def833746eb2 100644 --- a/lib/node_modules/@stdlib/array/uint64/benchmark/benchmark.get.js +++ b/lib/node_modules/@stdlib/array/uint64/benchmark/benchmark.get.js @@ -36,8 +36,7 @@ bench( format( '%s:get', pkg ), function benchmark( b ) { var v; var i; - arr = zeroTo( 10, 'generic' ); - arr = new Uint64Array( arr ); + arr = new Uint64Array( zeroTo( 10, 'generic' ) ); N = arr.length; b.tic(); From cd2cd62ab497fa04dc40210891531de7306ce38c Mon Sep 17 00:00:00 2001 From: Divit Date: Wed, 5 Aug 2026 08:48:06 +0000 Subject: [PATCH 2/2] feat: add method copywithin --- 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: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - 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: na - task: lint_license_headers status: passed --- --- .../@stdlib/array/uint64/lib/main.js | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/lib/node_modules/@stdlib/array/uint64/lib/main.js b/lib/node_modules/@stdlib/array/uint64/lib/main.js index c4c2be8f107c..855c409a95ee 100644 --- a/lib/node_modules/@stdlib/array/uint64/lib/main.js +++ b/lib/node_modules/@stdlib/array/uint64/lib/main.js @@ -597,6 +597,46 @@ setReadOnlyAccessor( Uint64Array.prototype, 'byteOffset', function get() { */ setReadOnly( Uint64Array.prototype, 'BYTES_PER_ELEMENT', Uint64Array.BYTES_PER_ELEMENT ); +/** +* Copies a sequence of elements within the array to the position starting at `target`. +* +* @name copyWithin +* @memberof Uint64Array.prototype +* @type {Function} +* @param {integer} target - index at which to start copying elements +* @param {integer} start - source index at which to copy elements from +* @param {integer} [end] - source index at which to stop copying elements from +* @throws {TypeError} `this` must be a 64-bit unsigned integer array +* @returns {Uint64Array} modified array +* +* @example +* var Uint64 = require( '@stdlib/number/uint64/ctor' ); +* +* var arr = new Uint64Array( 4 ); +* +* // Set the array elements: +* arr.set( 1, 0 ); +* arr.set( 2, 1 ); +* arr.set( 3, 2 ); +* arr.set( 4, 3 ); +* +* // Copy the first two elements to the last two elements: +* arr.copyWithin( 2, 0, 2 ); +* // arr => [ 1n, 2n, 1n, 2n ] +*/ +setReadOnly( Uint64Array.prototype, 'copyWithin', function copyWithin( target, start ) { + if ( !isUint64Array( this ) ) { + throw new TypeError( 'invalid invocation. `this` is not a 64-bit unsigned integer array.' ); + } + // FIXME: prefer a functional `copyWithin` implementation which addresses lack of universal browser support (e.g., IE11 and Safari) or ensure that typed arrays are polyfilled + if ( arguments.length === 2 ) { + this._buffer.copyWithin( target*2, start*2 ); + } else { + this._buffer.copyWithin( target*2, start*2, arguments[2]*2 ); + } + return this; +}); + /** * Returns an iterator for iterating over array key-value pairs. *