-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add methods for creating and interacting with BigInt
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
- Loading branch information
1 parent
086714b
commit a21a1f8
Showing
5 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters