Use precomputed values for MAX_ARRAY_LENGTH and MAX_SAFE_INTEGER.

This commit is contained in:
jdalton
2015-05-04 21:53:12 -07:00
parent 95b1455b62
commit 1afcfa4406

View File

@@ -835,7 +835,7 @@
POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
/** Used as references for the maximum length and index of an array. */
var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1,
var MAX_ARRAY_LENGTH = 4294967295,
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
@@ -846,7 +846,7 @@
* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)
* of an array-like value.
*/
var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;
var MAX_SAFE_INTEGER = 9007199254740991;
/** Used to store function metadata. */
var metaMap = WeakMap && new WeakMap;