Click or drag to resize

BitwiseCastToInt64 Method

Performs proper bitwise conversion between unsigned and signed value

Namespace: GSF
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.205-beta+5ef4169f3b1079d8b163dd363614f656bd140924
Syntax
public static long ToInt64(
	ulong unsignedInt
)
View Source

Parameters

unsignedInt  UInt64
Unsigned integer that is passed in to be converted to a long.

Return Value

Int64
The long value.
Remarks

This function is useful because Convert.ToInt64 will throw an OverflowException for values greater than Int64.MaxValue.

For example, this function correctly converts unsigned 64-bit integer 18446744073709551615 (i.e., UInt64.MaxValue) to signed 64-bit integer -1.

See Also