Class Arithmetic
Arithmetic helper class
Namespace: Unity.Netcode
Syntax
public static class Arithmetic
Methods
VarIntSize(UInt64)
Gets the output size in bytes after VarInting a unsigned integer
Declaration
public static int VarIntSize(ulong value)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | value | The unsigned integer whose length to get |
Returns
Type | Description |
---|---|
Int32 | The amount of bytes |
ZigZagDecode(UInt64)
Decides a ZigZag encoded integer back to a signed integer
Declaration
public static long ZigZagDecode(ulong value)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | value | The unsigned integer |
Returns
Type | Description |
---|---|
Int64 | The signed version of the integer |
ZigZagEncode(Int64)
ZigZag encodes a signed integer and maps it to a unsigned integer
Declaration
public static ulong ZigZagEncode(long value)
Parameters
Type | Name | Description |
---|---|---|
Int64 | value | The signed integer to encode |
Returns
Type | Description |
---|---|
UInt64 | A ZigZag encoded version of the integer |