You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.d.ts 10KB

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