C# Class LSLib.Granny.Model.HalfHelpers

Helper class for Half conversions and some low level operations. This class is internally used in the Half class.
References: - Fast Half Float Conversions, Jeroen van der Zijp, link: http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf
Exibir arquivo Open project: Norbyte/lslib Class Usage Examples

Public Methods

Method Description
HalfToSingle ( ushort half ) : float
SingleToHalf ( float single ) : ushort

Private Methods

Method Description
ConvertMantissa ( int i ) : uint
GenerateBaseTable ( ) : ushort[]
GenerateExponentTable ( ) : uint[]
GenerateMantissaTable ( ) : uint[]
GenerateOffsetTable ( ) : ushort[]
GenerateShiftTable ( ) : sbyte[]

Method Details

HalfToSingle() public static method

public static HalfToSingle ( ushort half ) : float
half ushort
return float

SingleToHalf() public static method

public static SingleToHalf ( float single ) : ushort
single float
return ushort