index.d.ts 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. export default Long;
  2. declare class Long {
  3. /**
  4. * 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.
  5. */
  6. constructor(low: number, high?: number, unsigned?: boolean);
  7. /**
  8. * Maximum unsigned value.
  9. */
  10. static MAX_UNSIGNED_VALUE: Long;
  11. /**
  12. * Maximum signed value.
  13. */
  14. static MAX_VALUE: Long;
  15. /**
  16. * Minimum signed value.
  17. */
  18. static MIN_VALUE: Long;
  19. /**
  20. * Signed negative one.
  21. */
  22. static NEG_ONE: Long;
  23. /**
  24. * Signed one.
  25. */
  26. static ONE: Long;
  27. /**
  28. * Unsigned one.
  29. */
  30. static UONE: Long;
  31. /**
  32. * Unsigned zero.
  33. */
  34. static UZERO: Long;
  35. /**
  36. * Signed zero
  37. */
  38. static ZERO: Long;
  39. /**
  40. * The high 32 bits as a signed value.
  41. */
  42. high: number;
  43. /**
  44. * The low 32 bits as a signed value.
  45. */
  46. low: number;
  47. /**
  48. * Whether unsigned or not.
  49. */
  50. unsigned: boolean;
  51. /**
  52. * 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.
  53. */
  54. static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long;
  55. /**
  56. * Returns a Long representing the given 32 bit integer value.
  57. */
  58. static fromInt(value: number, unsigned?: boolean): Long;
  59. /**
  60. * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
  61. */
  62. static fromNumber(value: number, unsigned?: boolean): Long;
  63. /**
  64. * Returns a Long representation of the given string, written using the specified radix.
  65. */
  66. static fromString(str: string, unsigned?: boolean | number, radix?: number): Long;
  67. /**
  68. * Creates a Long from its byte representation.
  69. */
  70. static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long;
  71. /**
  72. * Creates a Long from its little endian byte representation.
  73. */
  74. static fromBytesLE(bytes: number[], unsigned?: boolean): Long;
  75. /**
  76. * Creates a Long from its little endian byte representation.
  77. */
  78. static fromBytesBE(bytes: number[], unsigned?: boolean): Long;
  79. /**
  80. * Tests if the specified object is a Long.
  81. */
  82. static isLong(obj: any): obj is Long;
  83. /**
  84. * Converts the specified value to a Long.
  85. */
  86. static fromValue(val: Long | number | string | {low: number, high: number, unsigned: boolean}, unsigned?: boolean): Long;
  87. /**
  88. * Returns the sum of this and the specified Long.
  89. */
  90. add(addend: number | Long | string): Long;
  91. /**
  92. * Returns the bitwise AND of this Long and the specified.
  93. */
  94. and(other: Long | number | string): Long;
  95. /**
  96. * Compares this Long's value with the specified's.
  97. */
  98. compare(other: Long | number | string): number;
  99. /**
  100. * Compares this Long's value with the specified's.
  101. */
  102. comp(other: Long | number | string): number;
  103. /**
  104. * Returns this Long divided by the specified.
  105. */
  106. divide(divisor: Long | number | string): Long;
  107. /**
  108. * Returns this Long divided by the specified.
  109. */
  110. div(divisor: Long | number | string): Long;
  111. /**
  112. * Tests if this Long's value equals the specified's.
  113. */
  114. equals(other: Long | number | string): boolean;
  115. /**
  116. * Tests if this Long's value equals the specified's.
  117. */
  118. eq(other: Long | number | string): boolean;
  119. /**
  120. * Gets the high 32 bits as a signed integer.
  121. */
  122. getHighBits(): number;
  123. /**
  124. * Gets the high 32 bits as an unsigned integer.
  125. */
  126. getHighBitsUnsigned(): number;
  127. /**
  128. * Gets the low 32 bits as a signed integer.
  129. */
  130. getLowBits(): number;
  131. /**
  132. * Gets the low 32 bits as an unsigned integer.
  133. */
  134. getLowBitsUnsigned(): number;
  135. /**
  136. * Gets the number of bits needed to represent the absolute value of this Long.
  137. */
  138. getNumBitsAbs(): number;
  139. /**
  140. * Tests if this Long's value is greater than the specified's.
  141. */
  142. greaterThan(other: Long | number | string): boolean;
  143. /**
  144. * Tests if this Long's value is greater than the specified's.
  145. */
  146. gt(other: Long | number | string): boolean;
  147. /**
  148. * Tests if this Long's value is greater than or equal the specified's.
  149. */
  150. greaterThanOrEqual(other: Long | number | string): boolean;
  151. /**
  152. * Tests if this Long's value is greater than or equal the specified's.
  153. */
  154. gte(other: Long | number | string): boolean;
  155. /**
  156. * Tests if this Long's value is greater than or equal the specified's.
  157. */
  158. ge(other: Long | number | string): boolean;
  159. /**
  160. * Tests if this Long's value is even.
  161. */
  162. isEven(): boolean;
  163. /**
  164. * Tests if this Long's value is negative.
  165. */
  166. isNegative(): boolean;
  167. /**
  168. * Tests if this Long's value is odd.
  169. */
  170. isOdd(): boolean;
  171. /**
  172. * Tests if this Long's value is positive.
  173. */
  174. isPositive(): boolean;
  175. /**
  176. * Tests if this Long's value equals zero.
  177. */
  178. isZero(): boolean;
  179. /**
  180. * Tests if this Long's value equals zero.
  181. */
  182. eqz(): boolean;
  183. /**
  184. * Tests if this Long's value is less than the specified's.
  185. */
  186. lessThan(other: Long | number | string): boolean;
  187. /**
  188. * Tests if this Long's value is less than the specified's.
  189. */
  190. lt(other: Long | number | string): boolean;
  191. /**
  192. * Tests if this Long's value is less than or equal the specified's.
  193. */
  194. lessThanOrEqual(other: Long | number | string): boolean;
  195. /**
  196. * Tests if this Long's value is less than or equal the specified's.
  197. */
  198. lte(other: Long | number | string): boolean;
  199. /**
  200. * Tests if this Long's value is less than or equal the specified's.
  201. */
  202. le(other: Long | number | string): boolean;
  203. /**
  204. * Returns this Long modulo the specified.
  205. */
  206. modulo(other: Long | number | string): Long;
  207. /**
  208. * Returns this Long modulo the specified.
  209. */
  210. mod(other: Long | number | string): Long;
  211. /**
  212. * Returns this Long modulo the specified.
  213. */
  214. rem(other: Long | number | string): Long;
  215. /**
  216. * Returns the product of this and the specified Long.
  217. */
  218. multiply(multiplier: Long | number | string): Long;
  219. /**
  220. * Returns the product of this and the specified Long.
  221. */
  222. mul(multiplier: Long | number | string): Long;
  223. /**
  224. * Negates this Long's value.
  225. */
  226. negate(): Long;
  227. /**
  228. * Negates this Long's value.
  229. */
  230. neg(): Long;
  231. /**
  232. * Returns the bitwise NOT of this Long.
  233. */
  234. not(): Long;
  235. /**
  236. * Tests if this Long's value differs from the specified's.
  237. */
  238. notEquals(other: Long | number | string): boolean;
  239. /**
  240. * Tests if this Long's value differs from the specified's.
  241. */
  242. neq(other: Long | number | string): boolean;
  243. /**
  244. * Tests if this Long's value differs from the specified's.
  245. */
  246. ne(other: Long | number | string): boolean;
  247. /**
  248. * Returns the bitwise OR of this Long and the specified.
  249. */
  250. or(other: Long | number | string): Long;
  251. /**
  252. * Returns this Long with bits shifted to the left by the given amount.
  253. */
  254. shiftLeft(numBits: number | Long): Long;
  255. /**
  256. * Returns this Long with bits shifted to the left by the given amount.
  257. */
  258. shl(numBits: number | Long): Long;
  259. /**
  260. * Returns this Long with bits arithmetically shifted to the right by the given amount.
  261. */
  262. shiftRight(numBits: number | Long): Long;
  263. /**
  264. * Returns this Long with bits arithmetically shifted to the right by the given amount.
  265. */
  266. shr(numBits: number | Long): Long;
  267. /**
  268. * Returns this Long with bits logically shifted to the right by the given amount.
  269. */
  270. shiftRightUnsigned(numBits: number | Long): Long;
  271. /**
  272. * Returns this Long with bits logically shifted to the right by the given amount.
  273. */
  274. shru(numBits: number | Long): Long;
  275. /**
  276. * Returns this Long with bits logically shifted to the right by the given amount.
  277. */
  278. shr_u(numBits: number | Long): Long;
  279. /**
  280. * Returns the difference of this and the specified Long.
  281. */
  282. subtract(subtrahend: number | Long | string): Long;
  283. /**
  284. * Returns the difference of this and the specified Long.
  285. */
  286. sub(subtrahend: number | Long |string): Long;
  287. /**
  288. * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
  289. */
  290. toInt(): number;
  291. /**
  292. * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
  293. */
  294. toNumber(): number;
  295. /**
  296. * Converts this Long to its byte representation.
  297. */
  298. toBytes(le?: boolean): number[];
  299. /**
  300. * Converts this Long to its little endian byte representation.
  301. */
  302. toBytesLE(): number[];
  303. /**
  304. * Converts this Long to its big endian byte representation.
  305. */
  306. toBytesBE(): number[];
  307. /**
  308. * Converts this Long to signed.
  309. */
  310. toSigned(): Long;
  311. /**
  312. * Converts the Long to a string written in the specified radix.
  313. */
  314. toString(radix?: number): string;
  315. /**
  316. * Converts this Long to unsigned.
  317. */
  318. toUnsigned(): Long;
  319. /**
  320. * Returns the bitwise XOR of this Long and the given one.
  321. */
  322. xor(other: Long | number | string): Long;
  323. }