Struct NativeBitArray
An arbitrarily-sized array of bits.
Implements
Namespace: Unity.Collections
Assembly: solution.dll
Syntax
[NativeContainer]
public struct NativeBitArray : INativeDisposable
Remarks
The number of allocated bytes is always a multiple of 8. For example, a 65-bit array could fit in 9 bytes, but its allocation is actually 16 bytes.
Constructors
Name | Description |
---|---|
NativeBitArray(int, AllocatorHandle, NativeArrayOptions) | Initializes and returns an instance of NativeBitArray. |
Properties
Name | Description |
---|---|
Capacity | Returns the capacity number of bits. |
IsCreated | Whether this array has been allocated (and not yet deallocated). |
IsEmpty | Whether the container is empty. |
Length | Returns the number of bits. |
Methods
Name | Description |
---|---|
AsNativeArray<T>() | Returns a native array that aliases the content of this array. |
AsReadOnly() | Returns a readonly version of this NativeBitArray instance. |
Clear() | Sets all the bits to 0. |
Copy(int, int, int) | Copies a range of bits from this array to another range in this array. |
Copy(int, ref NativeBitArray, int, int) | Copies a range of bits from an array to a range of bits in this array. |
CountBits(int, int) | Returns the number of bits in a range that are 1. |
Dispose() | Releases all resources (memory and safety handles). |
Dispose(JobHandle) | Creates and schedules a job that will dispose this array. |
Find(int, int) | Finds the first length-N contiguous sequence of 0 bits in this bit array. |
Find(int, int, int) | Finds the first length-N contiguous sequence of 0 bits in this bit array. Searches only a subsection. |
GetBits(int, int) | Returns a ulong which has bits copied from this array. |
IsSet(int) | Returns true if the bit at an index is 1. |
Resize(int, NativeArrayOptions) | Sets the length, expanding the capacity if necessary. |
Set(int, bool) | Sets the bit at an index to 0 or 1. |
SetBits(int, bool, int) | Sets a range of bits to 0 or 1. |
SetBits(int, ulong, int) | Copies bits of a ulong to bits in this array. |
SetCapacity(int) | Sets the capacity. |
TrimExcess() | Sets the capacity to match what it would be if it had been originally initialized with all its entries. |