|
| 1 | +<!-- |
| 2 | +
|
| 3 | +@license Apache-2.0 |
| 4 | +
|
| 5 | +Copyright (c) 2026 The Stdlib Authors. |
| 6 | +
|
| 7 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | +you may not use this file except in compliance with the License. |
| 9 | +You may obtain a copy of the License at |
| 10 | +
|
| 11 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +
|
| 13 | +Unless required by applicable law or agreed to in writing, software |
| 14 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | +See the License for the specific language governing permissions and |
| 17 | +limitations under the License. |
| 18 | +
|
| 19 | +--> |
| 20 | + |
| 21 | +# add |
| 22 | + |
| 23 | +> Add two 64-bit unsigned integers. |
| 24 | +
|
| 25 | +<section class="intro"> |
| 26 | + |
| 27 | +</section> |
| 28 | + |
| 29 | +<!-- /.intro --> |
| 30 | + |
| 31 | +<section class="usage"> |
| 32 | + |
| 33 | +## Usage |
| 34 | + |
| 35 | +```javascript |
| 36 | +var add = require( '@stdlib/number/uint64/base/add' ); |
| 37 | +``` |
| 38 | + |
| 39 | +#### add( a, b ) |
| 40 | + |
| 41 | +Adds two 64-bit unsigned integers. |
| 42 | + |
| 43 | +```javascript |
| 44 | +var Uint64 = require( '@stdlib/number/uint64/ctor' ); |
| 45 | + |
| 46 | +var a = new Uint64( 5 ); |
| 47 | +var b = new Uint64( 10 ); |
| 48 | + |
| 49 | +var v = add( a, b ); |
| 50 | +// returns <Uint64>[ 15n ] |
| 51 | +``` |
| 52 | + |
| 53 | +#### add.assign( ah, al, bh, bl, out, so, oo ) |
| 54 | + |
| 55 | +Adds two 64-bit unsigned integers and assigns results to a provided output array. |
| 56 | + |
| 57 | +```javascript |
| 58 | +var Uint32Array = require( '@stdlib/array/uint32' ); |
| 59 | + |
| 60 | +var out = new Uint32Array( 2 ); |
| 61 | +var v = add.assign( 0, 5, 0, 10, out, 1, 0 ); |
| 62 | +// returns <Uint32Array>[ 0, 15 ] |
| 63 | + |
| 64 | +var bool = ( out === v ); |
| 65 | +// returns true |
| 66 | +``` |
| 67 | + |
| 68 | +The function supports the following parameters: |
| 69 | + |
| 70 | +- **ah**: high 32-bit word of the first 64-bit unsigned integer. |
| 71 | +- **al**: low 32-bit word of the first 64-bit unsigned integer. |
| 72 | +- **bh**: high 32-bit word of the second 64-bit unsigned integer. |
| 73 | +- **bl**: low 32-bit word of the second 64-bit unsigned integer. |
| 74 | +- **out**: output array. |
| 75 | +- **so**: stride length for `out`. |
| 76 | +- **oo**: starting index for `out`. |
| 77 | + |
| 78 | +#### add.strided( a, sa, oa, b, sb, ob, out, so, oo ) |
| 79 | + |
| 80 | +Adds two 64-bit unsigned integers stored in integer-valued strided array views and assigns results to a provided strided output array. |
| 81 | + |
| 82 | +```javascript |
| 83 | +var Uint32Array = require( '@stdlib/array/uint32' ); |
| 84 | + |
| 85 | +var a = new Uint32Array( [ 0, 5 ] ); |
| 86 | +var b = new Uint32Array( [ 0, 10 ] ); |
| 87 | +var out = new Uint32Array( 2 ); |
| 88 | + |
| 89 | +var v = add.strided( a, 1, 0, b, 1, 0, out, 1, 0 ); |
| 90 | +// returns <Uint32Array>[ 0, 15 ] |
| 91 | + |
| 92 | +var bool = ( out === v ); |
| 93 | +// returns true |
| 94 | +``` |
| 95 | + |
| 96 | +The function supports the following parameters: |
| 97 | + |
| 98 | +- **a**: first 64-bit unsigned integer strided array view containing interleaved 32-bit unsigned integer high and low order words. |
| 99 | +- **sa**: stride length for `a`. |
| 100 | +- **oa**: starting index for `a`. |
| 101 | +- **b**: second 64-bit unsigned integer strided array view containing interleaved 32-bit unsigned integer high and low order words. |
| 102 | +- **sb**: stride length for `b`. |
| 103 | +- **ob**: starting index for `b`. |
| 104 | +- **out**: output array. |
| 105 | +- **so**: stride length for `out`. |
| 106 | +- **oo**: starting index for `out`. |
| 107 | + |
| 108 | +</section> |
| 109 | + |
| 110 | +<!-- /.usage --> |
| 111 | + |
| 112 | +<section class="examples"> |
| 113 | + |
| 114 | +## Examples |
| 115 | + |
| 116 | +<!-- eslint no-undef: "error" --> |
| 117 | + |
| 118 | +```javascript |
| 119 | +var Uint64 = require( '@stdlib/number/uint64/ctor' ); |
| 120 | +var add = require( '@stdlib/number/uint64/base/add' ); |
| 121 | + |
| 122 | +var a = new Uint64( 5 ); |
| 123 | +var b = new Uint64( 10 ); |
| 124 | +var v = add( a, b ); |
| 125 | +// returns <Uint64>[ 15n ] |
| 126 | + |
| 127 | +a = new Uint64( 1234567890 ); |
| 128 | +b = new Uint64( 8765432109 ); |
| 129 | +v = add( a, b ); |
| 130 | +// returns <Uint64>[ 9999999999n ] |
| 131 | +``` |
| 132 | + |
| 133 | +</section> |
| 134 | + |
| 135 | +<!-- /.examples --> |
| 136 | + |
| 137 | +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> |
| 138 | + |
| 139 | +<section class="related"> |
| 140 | + |
| 141 | +</section> |
| 142 | + |
| 143 | +<!-- /.related --> |
| 144 | + |
| 145 | +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 146 | + |
| 147 | +<section class="links"> |
| 148 | + |
| 149 | +<!-- <related-links> --> |
| 150 | + |
| 151 | +<!-- </related-links> --> |
| 152 | + |
| 153 | +</section> |
| 154 | + |
| 155 | +<!-- /.links --> |
0 commit comments