Skip to main content

Unity.Netcode.Arithmetic

Arithmetic helper class

Inheritance#

System.Object

Arithmetic

Inherited Members#

System.Object.Equals(System.Object)

System.Object.Equals(System.Object, System.Object)

System.Object.GetHashCode()

System.Object.GetType()

System.Object.MemberwiseClone()

System.Object.ReferenceEquals(System.Object, System.Object)

System.Object.ToString()

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#
TypeNameDescription
System.UInt64valueThe unsigned integer whose length to get
Returns#
TypeDescription
System.Int32The amount of bytes

ZigZagDecode(UInt64)#

Decides a ZigZag encoded integer back to a signed integer

Declaration#
public static long ZigZagDecode(ulong value)
Parameters#
TypeNameDescription
System.UInt64valueThe unsigned integer
Returns#
TypeDescription
System.Int64The 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#
TypeNameDescription
System.Int64valueThe signed integer to encode
Returns#
TypeDescription
System.UInt64A ZigZag encoded version of the integer