UNPKG

low-level

Version:
45 lines (44 loc) 1.82 kB
import { Uint, type BasicUintConstructable } from "./uint.js"; import type { ByteArray, WithString, BinLike, New, WithArrayBuffer } from "./utils.js"; export interface FixedUintConstructable<T extends FixedUint> extends BasicUintConstructable<T> { readonly byteLength: number; alloc(fill?: string | Uint8Array | number): T; } export declare class FixedUint extends Uint { static readonly byteLength: number; constructor(buffer: BinLike); static create<T>(this: New<T>, input: BinLike): T; static alloc<T>(this: New<T>, fill?: string | Uint8Array | number): T; static empty<T>(this: New<T>): T; static from<T>(this: New<T>, arrayBuffer: WithArrayBuffer, byteOffset?: number, length?: number): T; static from<T>(this: New<T>, data: WithImplicitCoercion<ByteArray | string>): T; static from<T>(this: New<T>, str: WithString, encoding?: BufferEncoding): T; static from<T>(this: New<T>, number: number): T; } export declare class Uint8 extends FixedUint { static readonly byteLength = 1; } export declare class Uint16 extends FixedUint { static readonly byteLength = 2; } export declare class Uint32 extends FixedUint { static readonly byteLength = 4; } export declare abstract class AbstractBigUint extends FixedUint { protected addNumber(value: number): void; protected divNumber(value: number, returnRest: boolean): number | undefined; toShortUint(): Uint; } export declare class Uint64 extends AbstractBigUint { static readonly byteLength = 8; toBigInt(): bigint; } export declare class Uint96 extends AbstractBigUint { static readonly byteLength = 12; } export declare class Uint128 extends AbstractBigUint { static readonly byteLength = 16; } export declare class Uint256 extends AbstractBigUint { static readonly byteLength = 32; }