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