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 |
---|---|
Native |
Initializes and returns an instance of NativeBitArray. |
Properties
Name | Description |
---|---|
Capacity | Returns the capacity number of bits. |
Is |
Whether this array has been allocated (and not yet deallocated). |
Is |
Whether the container is empty. |
Length | Returns the number of bits. |
Methods
Name | Description |
---|---|
As |
Returns a native array that aliases the content of this array. |
As |
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 Native |
Copies a range of bits from an array to a range of bits in this array. |
Count |
Returns the number of bits in a range that are 1. |
Dispose() | Releases all resources (memory and safety handles). |
Dispose(Job |
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. |
Get |
Returns a ulong which has bits copied from this array. |
Is |
Returns true if the bit at an index is 1. |
Resize(int, Native |
Sets the length, expanding the capacity if necessary. |
Set(int, bool) | Sets the bit at an index to 0 or 1. |
Set |
Sets a range of bits to 0 or 1. |
Set |
Copies bits of a ulong to bits in this array. |
Set |
Sets the capacity. |
Trim |
Sets the capacity to match what it would be if it had been originally initialized with all its entries. |