UNPKG

ts-prims

Version:
108 lines 3.92 kB
import type { width, LowWidth, _8bit, _16bit, _24bit, _32bit, _40bit, _48bit, _54bit } from './width.js'; import { type prim } from './prim.js'; /** * Int type with low int width `W`. * * ```ts * type byte = int<1> * // type byte = number & supertype<number> & width<1> * * type word = int<2> * // type word = number & supertype<number> & width<2> * * let x: byte = 100 as byte * let y: word = 1000 as word * y = x // ok * x = y // error * // Type 'word' is not assignable to type 'byte'. * ``` * * @template W The width * @returns The int type with the specified (low) width * * @see {@link int8} for the first int in the low-width (fast) range * @see {@link int54} for the last int in the low-width (fast) range * @see {@link big} for the ints in the high-width (slow) range * @see {@link varint} for the low-level type that accepts all widths * @see {@link LowWidth} for the supported low number widths */ export type int<W extends LowWidth = 7> = prim<number, width<W>>; /** * @template W The `Width`, inferred from parameter `w`. * * @param w The width of this type * @returns The constructor for `int<W>` * * @see {@link int} * @see {@link LowWidth} */ export declare const Int: <W extends LowWidth = 7>(w?: W) => import("./prim.js").PrimConstructor<int<W>>; /** * `8`-bit integer in the `LowWidth` (fast) range. * * @see {@link int16} for the next int in the low-width (fast) range */ export type int8 = int<_8bit>; /** Constructor for {@link int8} */ export declare const Int8: import("./prim.js").PrimConstructor<int<1>>; /** * `16`-bit integer in the `LowWidth` (fast) range. * * @see {@link int8} for the previous int in the low-width (fast) range * @see {@link int24} for the next int in the low-width (fast) range */ export type int16 = int<_16bit>; /** Constructor for {@link int16} */ export declare const Int16: import("./prim.js").PrimConstructor<int<2>>; /** * `24`-bit integer in the `LowWidth` (fast) range. * * @see {@link int16} for the previous int in the low-width (fast) range * @see {@link int32} for the next int in the low-width (fast) range */ export type int24 = int<_24bit>; /** Constructor for {@link int24} */ export declare const Int24: import("./prim.js").PrimConstructor<int<3>>; /** * `32`-bit integer in the `LowWidth` (fast) range. * * @see {@link int24} for the previous int in the low-width (fast) range * @see {@link int40} for the next int in the low-width (fast) range */ export type int32 = int<_32bit>; /** Constructor for {@link int32} */ export declare const Int32: import("./prim.js").PrimConstructor<int<4>>; /** * `40`-bit integer in the `LowWidth` (fast) range. * * @see {@link int32} for the previous int in the low-width (fast) range * @see {@link int48} for the next int in the low-width (fast) range */ export type int40 = int<_40bit>; /** Constructor for {@link int40} */ export declare const Int40: import("./prim.js").PrimConstructor<int<5>>; /** * `48`-bit integer in the `LowWidth` (fast) range. * * @see {@link int40} for the previous int in the low-width (fast) range * @see {@link int54} for the next int in the low-width (fast) range */ export type int48 = int<_48bit>; /** Constructor for {@link int48} */ export declare const Int48: import("./prim.js").PrimConstructor<int<6>>; /** * `54`-bit integer in the `LowWidth` (fast) range. * * The widest 'low width' (fast) integer number type. * * Please do consider using this type over `big64` if at all possible, since it * will most likely lead to significantly better performance on the Javascript * platform. * * @see {@link int48} for the previous int in the low-width (fast) range * @see {@link big64} for the first int in the high-width (slow) range */ export type int54 = int<_54bit>; /** Constructor for {@link int54} */ export declare const Int54: import("./prim.js").PrimConstructor<int<7>>; //# sourceMappingURL=int.d.ts.map