Skip to content

Bitwise

arrayToBitFlags<T>(array): BitFlags<T>

Defined in: packages/isaacscript-common/src/functions/bitwise.ts:6

Helper function to convert a set of flags to a single BitFlags object.

T extends BitFlag | BitFlag128

readonly T[]

BitFlags<T>


convertBinaryToDecimal(bits): number

Defined in: packages/isaacscript-common/src/functions/bitwise.ts:18

Helper function to convert an array of bits to the resulting decimal number.

readonly int[]

number


convertDecimalToBinary(num, minLength?): readonly int[]

Defined in: packages/isaacscript-common/src/functions/bitwise.ts:32

Helper function to convert a number to an array of bits.

number

The number to convert.

int

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).

readonly int[]


countSetBits(num): int

Defined in: packages/isaacscript-common/src/functions/bitwise.ts:63

Helper function to count the number of bits that are set to 1 in a binary representation of a number.

int

int


getKBitOfN(k, n): int

Defined in: packages/isaacscript-common/src/functions/bitwise.ts:75

Helper function to get the value of a specific but in a binary representation of a number.

int

int

int


getNumBitsOfN(n): int

Defined in: packages/isaacscript-common/src/functions/bitwise.ts:80

Helper function to get the number of bits in a binary representation of a number.

int

int


setToBitFlags<T>(set): BitFlags<T>

Defined in: packages/isaacscript-common/src/functions/bitwise.ts:91

Helper function to convert a set of flags to a single BitFlags object.

T extends BitFlag | BitFlag128

ReadonlySet<T>

BitFlags<T>