Struct UnsafeAtomicCounter32
32-bit atomic counter.
Namespace: Unity.Collections.LowLevel.Unsafe
Syntax
public struct UnsafeAtomicCounter32
Constructors
UnsafeAtomicCounter32(Void*)
Constructor.
Declaration
public UnsafeAtomicCounter32(void *ptr)
Parameters
Type | Name | Description |
---|---|---|
Void* | ptr |
Fields
Counter
Counter value.
Declaration
public int *Counter
Field Value
Type | Description |
---|---|
Int32* |
Methods
Add(Int32)
Adds value to counter.
Declaration
public int Add(int value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | value | Value to add to counter. |
Returns
Type | Description |
---|---|
Int32 |
AddSat(Int32, Int32)
Add value to counter and saturate to maximum specified.
Declaration
public int AddSat(int value, int max = 2147483647)
Parameters
Type | Name | Description |
---|---|---|
Int32 | value | Value to add to counter. |
Int32 | max | Maximum value of counter. |
Returns
Type | Description |
---|---|
Int32 |
Reset(Int32)
Reset counter to value.
Declaration
public void Reset(int value = 0)
Parameters
Type | Name | Description |
---|---|---|
Int32 | value | Initial value. |
Sub(Int32)
Subtract value from counter.
Declaration
public int Sub(int value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | value | Value to subtract from counter. |
Returns
Type | Description |
---|---|
Int32 |
SubSat(Int32, Int32)
Subtract value from counter and staturate to minimum specified.
Declaration
public int SubSat(int value, int min = -2147483648)
Parameters
Type | Name | Description |
---|---|---|
Int32 | value | Value to subtract from counter. |
Int32 | min | Minumum value of counter. |
Returns
Type | Description |
---|---|
Int32 |