Skip to main content

DynamicBitset

A set of bits that can be dynamically resized.

TypeNameInterface Description
Functionsconstructor()

Function: Constructs a new instance of the DynamicBitset class.

Functionsconstructor(num_bits: number, value: number)

Function: Constructs a new DynamicBitset with a specified number of bits.

Parameters

num_bits: - The initial number of bits. All bits are initialized to 0.

value: - The initial value for all bits.

Functionsany(): boolean

Function: Checks if any bit is set to 1.

Returns true if at least one bit is set, false otherwise.

Functionsequals(v: DynamicBitset): boolean

Function: Compares this DynamicBitset with another for equality.

Parameters

v: - The DynamicBitset to compare with.

Returns true if the two bitsets are equal, false otherwise.

Functionsnone(): boolean

Function: Checks if no bits are set to 1.

Returns true if no bits are set, false otherwise.

Functionsreset(v: number): DynamicBitset

Function: Resets the bitset to a specified value.

Parameters

v: - The value to reset the bitset to.

Returns The modified DynamicBitset instance.

Functionsset(v?: number, v1?: number): void

Function: Set the value in the dynamic bitset. If no arguments are provided, sets the default value. If one argument is provided, sets the value at the specified index. If two arguments are provided, sets the range of values from the start index to the end index.

Parameters

v: - The index or start index for setting the value.

v1: - The end index for setting a range of values.

Functionstest(v: number): boolean

Function: Tests if a bit is set.

Parameters

v: - The index of the bit to test.

Returns true if the bit at index v is set, false otherwise.

FunctionstoString(): string

Function: Returns a string representation of the DynamicBitset.

Returns A string representing the current state of the DynamicBitset.

Static Functionsequals(v0: DynamicBitset, v1: DynamicBitset): boolean

Function: Compares two DynamicBitset instances for equality.

Parameters

a: - The first bitset to compare.

b: - The second bitset to compare.

Returns true if the two bitsets are equal, false otherwise.

Examples

constructor()

let obj = new APJS.DynamicBitset();

constructor(num_bits: number, value: number)

let obj = new APJS.DynamicBitset();

Use Case

@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
onStart() {
// TODO: instantiate / use DynamicBitset here
}
onUpdate(deltaTime: number) {
}
}
Copyright © 2026 TikTok. All rights reserved.
About TikTokHelp CenterCareersContactLegalTerms of ServicePrivacy PolicyCookies