mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
a21a1f845b
Summary: This change adds the following methods to jsi::BigInt * [static] fromInt64(value): creates a jsi::BigInt from a signed 64-bit value * [static] fromUint64(value): creates a jsi::BigInt from an unsigned 64-bit value * [static] strictEquals(a, b): return a === b, a and b are BigInts * asInt64(): truncates the BigInt to a single signed 64-bit integer; throws a JSIException if the truncation is lossy. * getInt64(): truncates the BigInt to a single signed 64-bit integer * isInt64(): returns true if the BigInt can be truncated losslessly to an int64_t * asUint64(): truncates the BigInt to a single unsigned 64-bit integer; throws a JSIException if the truncation is lossy. * getUint64(): truncates the BigInt to a single unsigned 64-bit integer * isUint64(): returns true if the BigInt can be truncated losslessly to an uint64_t * toString(radix): converts the BigInt to a string representing the number in the given radix. A lossy truncation is one that yields a result from which the BigInt cannot be reconstructed from, i.e., * BigInt::fromInt64(b.toInt64()) !== b * BigInt::fromUint64(b.toUint64()) !== b Changelog: [Internal] Reviewed By: kodafb Differential Revision: D37909139 fbshipit-source-id: 172848024f8367aed73cc602f38cde22f03cac8f