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