1 | export = Long;
|
---|
2 | export as namespace Long;
|
---|
3 |
|
---|
4 | declare namespace Long { }
|
---|
5 |
|
---|
6 | declare class Long {
|
---|
7 | /**
|
---|
8 | * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs.
|
---|
9 | */
|
---|
10 | constructor(low: number, high?: number, unsigned?: boolean);
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * Maximum unsigned value.
|
---|
14 | */
|
---|
15 | static MAX_UNSIGNED_VALUE: Long;
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * Maximum signed value.
|
---|
19 | */
|
---|
20 | static MAX_VALUE: Long;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * Minimum signed value.
|
---|
24 | */
|
---|
25 | static MIN_VALUE: Long;
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * Signed negative one.
|
---|
29 | */
|
---|
30 | static NEG_ONE: Long;
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * Signed one.
|
---|
34 | */
|
---|
35 | static ONE: Long;
|
---|
36 |
|
---|
37 | /**
|
---|
38 | * Unsigned one.
|
---|
39 | */
|
---|
40 | static UONE: Long;
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * Unsigned zero.
|
---|
44 | */
|
---|
45 | static UZERO: Long;
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * Signed zero
|
---|
49 | */
|
---|
50 | static ZERO: Long;
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * The high 32 bits as a signed value.
|
---|
54 | */
|
---|
55 | high: number;
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * The low 32 bits as a signed value.
|
---|
59 | */
|
---|
60 | low: number;
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * Whether unsigned or not.
|
---|
64 | */
|
---|
65 | unsigned: boolean;
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits.
|
---|
69 | */
|
---|
70 | static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long;
|
---|
71 |
|
---|
72 | /**
|
---|
73 | * Returns a Long representing the given 32 bit integer value.
|
---|
74 | */
|
---|
75 | static fromInt(value: number, unsigned?: boolean): Long;
|
---|
76 |
|
---|
77 | /**
|
---|
78 | * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
|
---|
79 | */
|
---|
80 | static fromNumber(value: number, unsigned?: boolean): Long;
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * Returns a Long representation of the given string, written using the specified radix.
|
---|
84 | */
|
---|
85 | static fromString(str: string, unsigned?: boolean | number, radix?: number): Long;
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * Creates a Long from its byte representation.
|
---|
89 | */
|
---|
90 | static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long;
|
---|
91 |
|
---|
92 | /**
|
---|
93 | * Creates a Long from its little endian byte representation.
|
---|
94 | */
|
---|
95 | static fromBytesLE(bytes: number[], unsigned?: boolean): Long;
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * Creates a Long from its big endian byte representation.
|
---|
99 | */
|
---|
100 | static fromBytesBE(bytes: number[], unsigned?: boolean): Long;
|
---|
101 |
|
---|
102 | /**
|
---|
103 | * Tests if the specified object is a Long.
|
---|
104 | */
|
---|
105 | static isLong(obj: any): obj is Long;
|
---|
106 |
|
---|
107 | /**
|
---|
108 | * Converts the specified value to a Long.
|
---|
109 | */
|
---|
110 | static fromValue(val: Long | number | string | {low: number, high: number, unsigned: boolean}, unsigned?: boolean): Long;
|
---|
111 |
|
---|
112 | /**
|
---|
113 | * Returns the sum of this and the specified Long.
|
---|
114 | */
|
---|
115 | add(addend: number | Long | string): Long;
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * Returns the bitwise AND of this Long and the specified.
|
---|
119 | */
|
---|
120 | and(other: Long | number | string): Long;
|
---|
121 |
|
---|
122 | /**
|
---|
123 | * Compares this Long's value with the specified's.
|
---|
124 | */
|
---|
125 | compare(other: Long | number | string): number;
|
---|
126 |
|
---|
127 | /**
|
---|
128 | * Compares this Long's value with the specified's.
|
---|
129 | */
|
---|
130 | comp(other: Long | number | string): number;
|
---|
131 |
|
---|
132 | /**
|
---|
133 | * Returns this Long divided by the specified.
|
---|
134 | */
|
---|
135 | divide(divisor: Long | number | string): Long;
|
---|
136 |
|
---|
137 | /**
|
---|
138 | * Returns this Long divided by the specified.
|
---|
139 | */
|
---|
140 | div(divisor: Long | number | string): Long;
|
---|
141 |
|
---|
142 | /**
|
---|
143 | * Tests if this Long's value equals the specified's.
|
---|
144 | */
|
---|
145 | equals(other: Long | number | string): boolean;
|
---|
146 |
|
---|
147 | /**
|
---|
148 | * Tests if this Long's value equals the specified's.
|
---|
149 | */
|
---|
150 | eq(other: Long | number | string): boolean;
|
---|
151 |
|
---|
152 | /**
|
---|
153 | * Gets the high 32 bits as a signed integer.
|
---|
154 | */
|
---|
155 | getHighBits(): number;
|
---|
156 |
|
---|
157 | /**
|
---|
158 | * Gets the high 32 bits as an unsigned integer.
|
---|
159 | */
|
---|
160 | getHighBitsUnsigned(): number;
|
---|
161 |
|
---|
162 | /**
|
---|
163 | * Gets the low 32 bits as a signed integer.
|
---|
164 | */
|
---|
165 | getLowBits(): number;
|
---|
166 |
|
---|
167 | /**
|
---|
168 | * Gets the low 32 bits as an unsigned integer.
|
---|
169 | */
|
---|
170 | getLowBitsUnsigned(): number;
|
---|
171 |
|
---|
172 | /**
|
---|
173 | * Gets the number of bits needed to represent the absolute value of this Long.
|
---|
174 | */
|
---|
175 | getNumBitsAbs(): number;
|
---|
176 |
|
---|
177 | /**
|
---|
178 | * Tests if this Long's value is greater than the specified's.
|
---|
179 | */
|
---|
180 | greaterThan(other: Long | number | string): boolean;
|
---|
181 |
|
---|
182 | /**
|
---|
183 | * Tests if this Long's value is greater than the specified's.
|
---|
184 | */
|
---|
185 | gt(other: Long | number | string): boolean;
|
---|
186 |
|
---|
187 | /**
|
---|
188 | * Tests if this Long's value is greater than or equal the specified's.
|
---|
189 | */
|
---|
190 | greaterThanOrEqual(other: Long | number | string): boolean;
|
---|
191 |
|
---|
192 | /**
|
---|
193 | * Tests if this Long's value is greater than or equal the specified's.
|
---|
194 | */
|
---|
195 | gte(other: Long | number | string): boolean;
|
---|
196 |
|
---|
197 | /**
|
---|
198 | * Tests if this Long's value is greater than or equal the specified's.
|
---|
199 | */
|
---|
200 | ge(other: Long | number | string): boolean;
|
---|
201 |
|
---|
202 | /**
|
---|
203 | * Tests if this Long's value is even.
|
---|
204 | */
|
---|
205 | isEven(): boolean;
|
---|
206 |
|
---|
207 | /**
|
---|
208 | * Tests if this Long's value is negative.
|
---|
209 | */
|
---|
210 | isNegative(): boolean;
|
---|
211 |
|
---|
212 | /**
|
---|
213 | * Tests if this Long's value is odd.
|
---|
214 | */
|
---|
215 | isOdd(): boolean;
|
---|
216 |
|
---|
217 | /**
|
---|
218 | * Tests if this Long's value is positive.
|
---|
219 | */
|
---|
220 | isPositive(): boolean;
|
---|
221 |
|
---|
222 | /**
|
---|
223 | * Tests if this Long's value equals zero.
|
---|
224 | */
|
---|
225 | isZero(): boolean;
|
---|
226 |
|
---|
227 | /**
|
---|
228 | * Tests if this Long's value equals zero.
|
---|
229 | */
|
---|
230 | eqz(): boolean;
|
---|
231 |
|
---|
232 | /**
|
---|
233 | * Tests if this Long's value is less than the specified's.
|
---|
234 | */
|
---|
235 | lessThan(other: Long | number | string): boolean;
|
---|
236 |
|
---|
237 | /**
|
---|
238 | * Tests if this Long's value is less than the specified's.
|
---|
239 | */
|
---|
240 | lt(other: Long | number | string): boolean;
|
---|
241 |
|
---|
242 | /**
|
---|
243 | * Tests if this Long's value is less than or equal the specified's.
|
---|
244 | */
|
---|
245 | lessThanOrEqual(other: Long | number | string): boolean;
|
---|
246 |
|
---|
247 | /**
|
---|
248 | * Tests if this Long's value is less than or equal the specified's.
|
---|
249 | */
|
---|
250 | lte(other: Long | number | string): boolean;
|
---|
251 |
|
---|
252 | /**
|
---|
253 | * Tests if this Long's value is less than or equal the specified's.
|
---|
254 | */
|
---|
255 | le(other: Long | number | string): boolean;
|
---|
256 |
|
---|
257 | /**
|
---|
258 | * Returns this Long modulo the specified.
|
---|
259 | */
|
---|
260 | modulo(other: Long | number | string): Long;
|
---|
261 |
|
---|
262 | /**
|
---|
263 | * Returns this Long modulo the specified.
|
---|
264 | */
|
---|
265 | mod(other: Long | number | string): Long;
|
---|
266 |
|
---|
267 | /**
|
---|
268 | * Returns this Long modulo the specified.
|
---|
269 | */
|
---|
270 | rem(other: Long | number | string): Long;
|
---|
271 |
|
---|
272 | /**
|
---|
273 | * Returns the product of this and the specified Long.
|
---|
274 | */
|
---|
275 | multiply(multiplier: Long | number | string): Long;
|
---|
276 |
|
---|
277 | /**
|
---|
278 | * Returns the product of this and the specified Long.
|
---|
279 | */
|
---|
280 | mul(multiplier: Long | number | string): Long;
|
---|
281 |
|
---|
282 | /**
|
---|
283 | * Negates this Long's value.
|
---|
284 | */
|
---|
285 | negate(): Long;
|
---|
286 |
|
---|
287 | /**
|
---|
288 | * Negates this Long's value.
|
---|
289 | */
|
---|
290 | neg(): Long;
|
---|
291 |
|
---|
292 | /**
|
---|
293 | * Returns the bitwise NOT of this Long.
|
---|
294 | */
|
---|
295 | not(): Long;
|
---|
296 |
|
---|
297 | /**
|
---|
298 | * Tests if this Long's value differs from the specified's.
|
---|
299 | */
|
---|
300 | notEquals(other: Long | number | string): boolean;
|
---|
301 |
|
---|
302 | /**
|
---|
303 | * Tests if this Long's value differs from the specified's.
|
---|
304 | */
|
---|
305 | neq(other: Long | number | string): boolean;
|
---|
306 |
|
---|
307 | /**
|
---|
308 | * Tests if this Long's value differs from the specified's.
|
---|
309 | */
|
---|
310 | ne(other: Long | number | string): boolean;
|
---|
311 |
|
---|
312 | /**
|
---|
313 | * Returns the bitwise OR of this Long and the specified.
|
---|
314 | */
|
---|
315 | or(other: Long | number | string): Long;
|
---|
316 |
|
---|
317 | /**
|
---|
318 | * Returns this Long with bits shifted to the left by the given amount.
|
---|
319 | */
|
---|
320 | shiftLeft(numBits: number | Long): Long;
|
---|
321 |
|
---|
322 | /**
|
---|
323 | * Returns this Long with bits shifted to the left by the given amount.
|
---|
324 | */
|
---|
325 | shl(numBits: number | Long): Long;
|
---|
326 |
|
---|
327 | /**
|
---|
328 | * Returns this Long with bits arithmetically shifted to the right by the given amount.
|
---|
329 | */
|
---|
330 | shiftRight(numBits: number | Long): Long;
|
---|
331 |
|
---|
332 | /**
|
---|
333 | * Returns this Long with bits arithmetically shifted to the right by the given amount.
|
---|
334 | */
|
---|
335 | shr(numBits: number | Long): Long;
|
---|
336 |
|
---|
337 | /**
|
---|
338 | * Returns this Long with bits logically shifted to the right by the given amount.
|
---|
339 | */
|
---|
340 | shiftRightUnsigned(numBits: number | Long): Long;
|
---|
341 |
|
---|
342 | /**
|
---|
343 | * Returns this Long with bits logically shifted to the right by the given amount.
|
---|
344 | */
|
---|
345 | shru(numBits: number | Long): Long;
|
---|
346 |
|
---|
347 | /**
|
---|
348 | * Returns this Long with bits logically shifted to the right by the given amount.
|
---|
349 | */
|
---|
350 | shr_u(numBits: number | Long): Long;
|
---|
351 |
|
---|
352 | /**
|
---|
353 | * Returns this Long with bits rotated to the left by the given amount.
|
---|
354 | */
|
---|
355 | rotateLeft(numBits: number | Long): Long;
|
---|
356 |
|
---|
357 | /**
|
---|
358 | * Returns this Long with bits rotated to the left by the given amount.
|
---|
359 | */
|
---|
360 | rotl(numBits: number | Long): Long;
|
---|
361 |
|
---|
362 | /**
|
---|
363 | * Returns this Long with bits rotated to the right by the given amount.
|
---|
364 | */
|
---|
365 | rotateRight(numBits: number | Long): Long;
|
---|
366 |
|
---|
367 | /**
|
---|
368 | * Returns this Long with bits rotated to the right by the given amount.
|
---|
369 | */
|
---|
370 | rotr(numBits: number | Long): Long;
|
---|
371 |
|
---|
372 | /**
|
---|
373 | * Returns the difference of this and the specified Long.
|
---|
374 | */
|
---|
375 | subtract(subtrahend: number | Long | string): Long;
|
---|
376 |
|
---|
377 | /**
|
---|
378 | * Returns the difference of this and the specified Long.
|
---|
379 | */
|
---|
380 | sub(subtrahend: number | Long |string): Long;
|
---|
381 |
|
---|
382 | /**
|
---|
383 | * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
|
---|
384 | */
|
---|
385 | toInt(): number;
|
---|
386 |
|
---|
387 | /**
|
---|
388 | * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
|
---|
389 | */
|
---|
390 | toNumber(): number;
|
---|
391 |
|
---|
392 | /**
|
---|
393 | * Converts this Long to its byte representation.
|
---|
394 | */
|
---|
395 |
|
---|
396 | toBytes(le?: boolean): number[];
|
---|
397 |
|
---|
398 | /**
|
---|
399 | * Converts this Long to its little endian byte representation.
|
---|
400 | */
|
---|
401 |
|
---|
402 | toBytesLE(): number[];
|
---|
403 |
|
---|
404 | /**
|
---|
405 | * Converts this Long to its big endian byte representation.
|
---|
406 | */
|
---|
407 |
|
---|
408 | toBytesBE(): number[];
|
---|
409 |
|
---|
410 | /**
|
---|
411 | * Converts this Long to signed.
|
---|
412 | */
|
---|
413 | toSigned(): Long;
|
---|
414 |
|
---|
415 | /**
|
---|
416 | * Converts the Long to a string written in the specified radix.
|
---|
417 | */
|
---|
418 | toString(radix?: number): string;
|
---|
419 |
|
---|
420 | /**
|
---|
421 | * Converts this Long to unsigned.
|
---|
422 | */
|
---|
423 | toUnsigned(): Long;
|
---|
424 |
|
---|
425 | /**
|
---|
426 | * Returns the bitwise XOR of this Long and the given one.
|
---|
427 | */
|
---|
428 | xor(other: Long | number | string): Long;
|
---|
429 | }
|
---|