main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
703 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var GetIntrinsic = require('get-intrinsic');
|
---|
| 4 |
|
---|
| 5 | var $BigInt = GetIntrinsic('%BigInt%', true);
|
---|
| 6 | var $pow = GetIntrinsic('%Math.pow%');
|
---|
| 7 |
|
---|
| 8 | var ToBigInt = require('./ToBigInt');
|
---|
| 9 | var BigIntRemainder = require('./BigInt/remainder');
|
---|
| 10 |
|
---|
| 11 | var modBigInt = require('../helpers/modBigInt');
|
---|
| 12 |
|
---|
| 13 | // BigInt(2**64), but node v10.4-v10.8 have a bug where you can't `BigInt(x)` anything larger than MAX_SAFE_INTEGER
|
---|
| 14 | var twoSixtyFour = $BigInt && (BigInt($pow(2, 32)) * BigInt($pow(2, 32)));
|
---|
| 15 |
|
---|
| 16 | // https://262.ecma-international.org/11.0/#sec-tobiguint64
|
---|
| 17 |
|
---|
| 18 | module.exports = function ToBigUint64(argument) {
|
---|
| 19 | var n = ToBigInt(argument);
|
---|
| 20 | var int64bit = modBigInt(BigIntRemainder, n, twoSixtyFour);
|
---|
| 21 | return int64bit;
|
---|
| 22 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.