* Get the number of bits needed to represent the absolute value of this Int64 * @this {!Int64} * @returns {number} Number of represented bits
()
| 387 | * @returns {number} Number of represented bits |
| 388 | */ |
| 389 | get NumBits () { |
| 390 | if (this.isNegative) { |
| 391 | return this.eq(INT64_MIN) ? 64 : this.neg().NumBits |
| 392 | } |
| 393 | |
| 394 | let val = (this.high !== 0) ? this.high : this.low |
| 395 | |
| 396 | let bit |
| 397 | for (bit = 31; bit > 0; bit--) { |
| 398 | if ((val & (1 << bit)) !== 0) { |
| 399 | break |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | return (this.high !== 0) ? (bit + 33) : (bit + 1) |
| 404 | } |
| 405 | |
| 406 | /** |
| 407 | * Is this value zero? |