Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
26f9a3f
chore: copy main.js from `number/float16/ctor`
impawstarlight Mar 12, 2026
c9b0b08
chore: rename float16 stuff to uint64
impawstarlight Mar 12, 2026
dd5a4d6
feat: add asBigUint64 function to truncate BigInt to unsigned 64-bit …
impawstarlight Mar 13, 2026
03e0b6a
feat: add toString, toJSON, and valueOf
impawstarlight Mar 13, 2026
b27d0e1
feat: implement Uint64 constructor with support for BigInt, Uint32Arr…
impawstarlight Mar 13, 2026
7c40edd
feat: add README and package.json
impawstarlight Mar 13, 2026
8ecf428
feat: add index.js
impawstarlight Mar 13, 2026
64e4a30
docs: remove `value` property from README since it should be private …
impawstarlight Mar 13, 2026
b438d53
test: implement initial tests
impawstarlight Mar 13, 2026
77609f7
docs: update todo comment
impawstarlight Mar 13, 2026
e367b17
bench: add initial benchmarks
impawstarlight Mar 13, 2026
aa937a4
docs: add types
impawstarlight Mar 13, 2026
de8ca59
docs: add javascript example
impawstarlight Mar 13, 2026
3420ebf
fix: resovle lint errors
impawstarlight Mar 13, 2026
fc00588
fix: resolve lint errors
impawstarlight Mar 13, 2026
afbeaa2
feat: implement toString with high low words
impawstarlight Mar 13, 2026
9d932db
feat: update Uint64 constructor to support setting preferred represen…
impawstarlight Mar 13, 2026
3926d9a
chore: remove unused paths from package.json
impawstarlight Mar 13, 2026
f1ab12d
bench: fix benchmark error
impawstarlight Mar 13, 2026
b2fd1f6
chore: update copyright years
impawstarlight Mar 13, 2026
b6e19aa
test: add more tests
impawstarlight Mar 14, 2026
8097552
fix: fix unnecessary leading zeros in toString()
impawstarlight Mar 14, 2026
cef9e28
feat: implement string parsing in Uint64 constructor
impawstarlight Mar 14, 2026
85a9378
test: add tests for parsing prefixed and whitespace-padded strings in…
impawstarlight Mar 14, 2026
2945c32
fix: update TODO comments for clarity and valueOf implementation
impawstarlight Mar 17, 2026
aae8b27
refactor: refactor parsing logic out of Uint64 constructor and more
impawstarlight Mar 19, 2026
45ecf21
test: update and add tests
impawstarlight Mar 19, 2026
071df31
docs: update type declaration
impawstarlight Mar 19, 2026
0ee526d
docs: fix type declaration
impawstarlight Mar 19, 2026
0a9a5ea
Merge branch 'develop' into feature/uint64
impawstarlight Mar 29, 2026
7cd12ee
refactor: update implementation and split out logic for materializing…
kgryte Apr 21, 2026
f220a9c
docs: update typescript declaration with `from` and `of` static methods
impawstarlight Apr 22, 2026
35b1369
docs: fix type annotations for Uint64 constructor, valueOf method, an…
impawstarlight Apr 22, 2026
26d1d14
docs: improve toJSON return type in typescript declarations
impawstarlight May 13, 2026
d0cf1ea
refactor: reorder properties and methods declaration in main
impawstarlight May 13, 2026
7505f67
test: add tests for Uint64 constructor and static methods and properties
impawstarlight May 13, 2026
fd8da09
fix: update toJSON return type in TypeScript test
impawstarlight May 13, 2026
fd5508c
test: add tests for remaining properties and methods
impawstarlight May 15, 2026
a070465
fix: fix toString implementation
impawstarlight May 15, 2026
bfbe476
remove: remove `from-string` package to be added in a separate branch
impawstarlight May 21, 2026
a0752a7
bench: add benchmarks for `from`, `of`, and `valueOf`
impawstarlight May 21, 2026
943b3fc
refactor: update `toString` to accept radix parameter and minor refac…
impawstarlight May 21, 2026
b49762b
chore: update example to match with readme
impawstarlight May 21, 2026
0ab7a25
bench: update benchmark for `valueOf` to address multiple return type
impawstarlight May 21, 2026
afb2e70
docs: update typescript definitions
impawstarlight May 21, 2026
e6f161c
test: add unit tests for `from`, `of`, and `toString` methods in sepa…
impawstarlight May 21, 2026
525c560
docs: reorder repl documentation for BYTES_PER_ELEMENT
impawstarlight May 21, 2026
2c9f0c0
docs: update JSON representation example in README for Uint64
impawstarlight May 21, 2026
bd45ce7
Merge branch 'develop' into feature/uint64
kgryte May 22, 2026
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
262 changes: 262 additions & 0 deletions lib/node_modules/@stdlib/number/uint64/ctor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
<!--

@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.

-->

# Uint64

> Unsigned 64-bit integer.

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- Package usage documentation. -->

<section class="usage">

## Usage

```javascript
var Uint64 = require( '@stdlib/number/uint64/ctor' );
```

#### Uint64( value )

Unsigned 64-bit integer constructor.

```javascript
var x = new Uint64( 5 );
// returns <Uint64>
```

* * *

## Properties

#### Uint64.name

Static property returning the constructor name.

```javascript
var str = Uint64.name;
// returns 'Uint64'
```

#### Uint64.BYTES_PER_ELEMENT

Size (in bytes) of the underlying value.

```javascript
var nbytes = Uint64.BYTES_PER_ELEMENT;
// returns 8
```

#### Uint64.prototype.BYTES_PER_ELEMENT

Size (in bytes) of the underlying value.

```javascript
var x = new Uint64( 5 );

var nbytes = x.BYTES_PER_ELEMENT;
// returns 8
```

#### Uint64.prototype.byteLength

Size (in bytes) of the underlying value.

```javascript
var x = new Uint64( 5 );

var nbytes = x.byteLength;
// returns 8
```

#### Uint64.prototype.hi

High 32-bit word of an unsigned 64-bit integer.

```javascript
var x = Uint64.from( [ 1234, 5678 ] );

var w = x.hi;
// returns 1234
```

#### Uint64.prototype.lo

Low 32-bit word of an unsigned 64-bit integer.

```javascript
var x = Uint64.from( [ 1234, 5678 ] );

var w = x.lo;
// returns 5678
```

* * *

## Methods

### Static Methods

#### Uint64.from( array )

Creates a new unsigned 64-bit integer from an array-like object containing a high and low word.

```javascript
var x = Uint64.from( [ 1234, 5678 ] );
// returns <Uint64>
```

#### Uint64.of( high, low )

Creates a new unsigned 64-bit integer from a high and low word.

```javascript
var x = Uint64.of( 1234, 5678 );
// returns <Uint64>
```

### Accessor Methods

These methods do **not** mutate a `Uint64` instance and, instead, return an unsigned 64-bit integer representation.

#### Uint64.prototype.toString()

Returns a string representation of a `Uint64` instance.

```javascript
var x = new Uint64( 5 );
var str = x.toString();
// returns '5'
```

#### Uint64.prototype.toJSON()

Returns a [JSON][json] representation of a `Uint64` instance. [`JSON.stringify()`][mdn-json-stringify] implicitly calls this method when stringifying a `Uint64` instance.

```javascript
var x = new Uint64( 5 );

var o = x.toJSON();
// returns { 'type': 'Uint64', 'words': [ 0, 5 ] }
```

To [revive][mdn-json-parse] a `Uint64` instance from a [JSON][json] string, see [@stdlib/number/uint64/reviver][@stdlib/number/uint64/reviver].

#### Uint64.prototype.valueOf()

Converts a `Uint64` instance to a primitive value.

```javascript
var x = new Uint64( 5 );

var v = x.valueOf();
// e.g., returns <bigint>
```

</section>

<!-- /.usage -->

* * *

<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

## Notes

- An unsigned 64-bit integer has a range of \[`0`, `2^64-1`\].

</section>

<!-- /.notes -->

* * *

<!-- Package usage examples. -->

<section class="examples">

## Examples

<!-- eslint no-undef: "error" -->

```javascript
var Uint64 = require( '@stdlib/number/uint64/ctor' );

var x = new Uint64( 1234 );

console.log( 'type: %s', typeof x );
// => 'type: object'

console.log( 'str: %s', x );
// => 'str: 1234'

console.log( 'JSON: %s', JSON.stringify( x ) );
// => 'JSON: {"type":"Uint64","words":[0,1234]}'
```

</section>

<!-- /.examples -->


<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="references">

</section>

<!-- /.references -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">

</section>

<!-- /.related -->

<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="links">

[json]: http://www.json.org/

[mdn-json-stringify]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify

[mdn-json-parse]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse

[@stdlib/number/uint64/reviver]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/number/uint64/reviver

<!-- <related-links> -->

<!-- </related-links> -->

</section>

<!-- /.links -->
Loading
Loading