* Returns Int64 representing the given value, provided that it is a finite number. Otherwise, zero is returned. * @param {number} value 32-bit integer value * @returns {!Int64} The corresponding Int64 value
(value)
| 137 | * @returns {!Int64} The corresponding Int64 value |
| 138 | */ |
| 139 | static fromNumber (value) { |
| 140 | if (isNaN(value)) { |
| 141 | return INT64_ZERO |
| 142 | } |
| 143 | if (value <= -INT64_TWO_PWR_63_DBL) { |
| 144 | return INT64_MIN |
| 145 | } |
| 146 | if (value + 1 >= INT64_TWO_PWR_63_DBL) { |
| 147 | return INT64_MAX |
| 148 | } |
| 149 | if (value < 0) { |
| 150 | return Int64.fromNumber(-value).neg() |
| 151 | } |
| 152 | return Int64.fromBits((value % INT64_TWO_PWR_32_DBL) | 0, (value / INT64_TWO_PWR_32_DBL) | 0) |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * Returns Int64 representation of the given string, written using the specified radix. |