Click or drag to resize

BitwiseCastToUInt16 Method

Performs proper bitwise conversion between signed and unsigned value

Namespace: GSF
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.263-beta+46da57839405c6f25e1a2652b0dc32fdd781900f
Syntax
public static ushort ToUInt16(
	short signedInt
)
View Source

Parameters

signedInt  Int16
Signed integer that is passed in to be converted to an unsigned short.

Return Value

UInt16
The unsigned short value.
Remarks

This function is useful because Convert.ToUInt16 will throw an OverflowException for values less than zero.

For example, this function correctly converts signed 16-bit integer -32768 (i.e., Int16.MinValue) to unsigned 16-bit integer 32768.

See Also