UNPKG

@microsoft/dev-tunnels-ssh

Version:
50 lines 1.95 kB
/// <reference types="node" /> import { Buffer } from 'buffer'; /** * Represents a large signed integer as a byte byffer. */ export declare class BigInt { private readonly buffer; static readonly zero: BigInt; /** * Creates a new BigInt instance from a buffer of signed bytes. * * The first (high) bit of the first (high) byte is the sign bit. Therefore if the * highest byte of an unsigned integer is greater than 127, the bytes must include * a leading zero byte to prevent interpretation as a negative value. */ constructor(buffer: Buffer); /** * Gets a value that indicates the sign of the big integer: * 1 for positive, 0 for zero, -1 for negative. */ get sign(): number; static fromInt32(value: number): BigInt; toInt32(): number; /** * Creates a new BigInt instance from a byte buffer. * @param bytes Source byte buffer. * @param options.unsigned True if the bytes should be interpreted as unsigned. If false, * the high bit of the high byte is the sign bit. The default is false. */ static fromBytes(bytes: Buffer, options?: { unsigned?: boolean; }): BigInt; /** * Converts a BigInt instance to a byte buffer. * * @param options.unsigned True if the returned bytes will be interprted as unsigned. * If false, a positive integer may have a leading zero to prevent it from being * interpreted as negative. * @param options.length Desired length of the resulting buffer. The value will be zero- * padded to fill the length. Only applies when `options.unsigned` is true. */ toBytes(options?: { unsigned?: boolean; length?: number; }): Buffer; copyTo(buffer: Buffer, offset?: number): void; equals(other: BigInt): boolean; toString(name?: string): string; } //# sourceMappingURL=bigInt.d.ts.map