Struct UnsafeBitArray
An arbitrarily-sized array of bits.
Implements
Namespace: Unity.Collections.LowLevel .Unsafe
Assembly: solution.dll
Syntax
public struct UnsafeBitArray : 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 |
---|---|
Unsafe |
Initializes and returns an instance of UnsafeBitArray. |
Unsafe |
Initializes and returns an instance of UnsafeBitArray which aliases an existing buffer. |
Fields
Name | Description |
---|---|
Allocator | The allocator to use. |
Capacity | The capacity number of bits. |
Length | The number of bits. |
Ptr | Pointer to the data. |
Properties
Name | Description |
---|---|
Is |
Whether this array has been allocated (and not yet deallocated). |
Is |
Whether the container is empty. |
Methods
Name | Description |
---|---|
As |
Returns a readonly version of this UnsafeBitArray 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 Unsafe |
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) | Returns the index of the first occurrence in this array of N contiguous 0 bits. |
Find(int, int, int) | Returns the index of the first occurrence in this array of a given number of contiguous 0 bits. |
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(ulong*, 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. |