crypto: drop Math.pow(), use static exponentation
PR-URL: https://github.com/nodejs/node/pull/20816 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
parent
078bb0f0a0
commit
f1d9c7dbb9
@ -11,7 +11,7 @@ const {
|
|||||||
const { isArrayBufferView } = require('internal/util/types');
|
const { isArrayBufferView } = require('internal/util/types');
|
||||||
|
|
||||||
const { kMaxLength } = require('buffer');
|
const { kMaxLength } = require('buffer');
|
||||||
const kMaxUint32 = Math.pow(2, 32) - 1;
|
const kMaxUint32 = 2 ** 32 - 1;
|
||||||
const kMaxPossibleLength = Math.min(kMaxLength, kMaxUint32);
|
const kMaxPossibleLength = Math.min(kMaxLength, kMaxUint32);
|
||||||
|
|
||||||
function assertOffset(offset, elementSize, length) {
|
function assertOffset(offset, elementSize, length) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user