isaacscript-common
Version:
Helper functions and features for IsaacScript mods.
26 lines • 1.57 kB
TypeScript
/** Helper function to convert a set of flags to a single `BitFlags` object. */
export declare function arrayToBitFlags<T extends BitFlag | BitFlag128>(array: readonly T[]): BitFlags<T>;
/** Helper function to convert an array of bits to the resulting decimal number. */
export declare function convertBinaryToDecimal(bits: readonly int[]): number;
/**
* Helper function to convert a number to an array of bits.
*
* @param num The number to convert.
* @param minLength Optional. Equal to the minimum amount of bits that should be returned. If the
* converted number of bits is below this number, 0's will be padded to the left
* side until the minimum length is met. Default is undefined (which will not cause
* any padding).
*/
export declare function convertDecimalToBinary(num: number, minLength?: int): readonly int[];
/**
* Helper function to count the number of bits that are set to 1 in a binary representation of a
* number.
*/
export declare function countSetBits(num: int): int;
/** Helper function to get the value of a specific but in a binary representation of a number. */
export declare function getKBitOfN(k: int, n: int): int;
/** Helper function to get the number of bits in a binary representation of a number. */
export declare function getNumBitsOfN(n: int): int;
/** Helper function to convert a set of flags to a single `BitFlags` object. */
export declare function setToBitFlags<T extends BitFlag | BitFlag128>(set: ReadonlySet<T>): BitFlags<T>;
//# sourceMappingURL=bitwise.d.ts.map