UNPKG

bitwise-operation

Version:

JavaScript's bitwise operation helper library.

51 lines (50 loc) 2.17 kB
declare type BitwiseValue = number | string | Array<0 | 1> | Bitwise; export declare class Bitwise { private value; static VERSION: string; constructor(value?: BitwiseValue); static chain(value?: BitwiseValue): Bitwise; static not(value: number): number; static and(value: BitwiseValue, ...values: BitwiseValue[]): number; static nand(value: BitwiseValue, ...values: BitwiseValue[]): number; static andNot(value: BitwiseValue, ...values: BitwiseValue[]): number; static or(value: BitwiseValue, ...values: BitwiseValue[]): number; static nor(value: BitwiseValue, ...values: BitwiseValue[]): number; static xor(value: BitwiseValue, ...values: BitwiseValue[]): number; static xnor(value: BitwiseValue, ...values: BitwiseValue[]): number; static nxor(value: BitwiseValue, ...values: BitwiseValue[]): number; static toggle(value: BitwiseValue, ...idx: number[]): number; static swap(value: BitwiseValue, ...idx: [number, number][]): number; static mask(to: number): number; static mask(from: number, to: number): number; not(): this; and(value: BitwiseValue): this; nand(value: BitwiseValue): this; andNot(value: BitwiseValue): this; or(value: BitwiseValue): this; nor(value: BitwiseValue): this; xor(value: BitwiseValue): this; xnor(value: BitwiseValue): this; nxor(value: BitwiseValue): this; set(idx: number, value?: boolean): this; unset(idx: number): this; get(idx: number): boolean; toggle(idx: number): this; swap(idx1: number, idx2: number): this; setRange(from: number, to: number): this; unsetRange(from: number, to: number): this; toggleRange(from: number, to: number): this; mask(from: number, to: number): this; clear(from: number, to: number): this; equals(value: BitwiseValue): boolean; setValue(value: BitwiseValue): this; copy(): Bitwise; clone(): Bitwise; valueOf(): number; toString(length?: number, separator?: string): string; toArray(): Array<0 | 1>; cardinality(): number; length(): number; size(): number; } export {};