Baseline Widely available
BigInt.asUintN
éææ¹æ³å° BigInt
转æ¢ä¸ºä¸ä¸ª 0 å 2^width-1 ä¹é´çæ ç¬¦å·æ´æ°ã
const U64_CEIL = 2n ** 64n;
console.log(BigInt.asUintN(64, U64_CEIL - 1n));
// 18446744073709551615n (2n ** 64n - 1n, the maximum non-wrapping value)
console.log(BigInt.asUintN(64, U64_CEIL));
// 0n (wraps to zero)
console.log(BigInt.asUintN(64, U64_CEIL + 1n));
// 1n
console.log(BigInt.asUintN(64, U64_CEIL * 2n));
// 0n (wraps on multiples)
console.log(BigInt.asUintN(64, U64_CEIL * -42n));
// 0n (also wraps on negative multiples)
è¯æ³
BigInt.asUintN(width, bigint);åæ°
width
å¯å卿´æ°ç使°ã
bigint
è¦åå¨å¨æå®ä½æ°ä¸çæ´æ°ã
bigint
模 (modulo) 2^width
ä½ä¸ºæ ç¬¦å·æ´æ°çå¼ã
BigInt.asUintN()
æ¹æ³å¯¹äºä¿æå¨ 64 ä½ (64-bit) ç®æ°èå´å
é常æç¨ã
const max = 2n ** 64n - 1n;
BigInt.asUintN(64, max);
// ⪠18446744073709551615n
BigInt.asUintN(64, max + 1n);
// ⪠0n
// zero because of overflow
è§è æµè§å¨å
¼å®¹æ§ 请åé
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4