• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1export function createLong(low: number, high: number): Long {
2    return Long.create(low, high);
3}
4
5export class Long {
6    static readonly ZERO = new Long(0, 0)
7    low: number
8    high: number
9    constructor(low: number, high: number) {
10        this.low = low | 0;
11        this.high = high | 0;
12    }
13    static create(low: number, high: number): Long {
14        // Special-case zero to avoid GC overhead for default values
15        return low == 0 && high == 0 ? Long.ZERO : new Long(low, high);
16    }
17    toFloat64(): number {
18        return (this.low >>> 0) + this.high * 0x100000000;
19    }
20    equals(other: Long): boolean {
21        return this.low == other.low && this.high == other.high;
22    }
23}