ADBaseLibrary.Matroska.MatroskaExtensions.Ebml_Read_Float C# (CSharp) Method

Ebml_Read_Float() public static method

public static Ebml_Read_Float ( this reader, int size, double &num ) : int
reader this
size int
num double
return int
        public static int Ebml_Read_Float(this BinaryReader reader, int size, out double num)
        {
            if (size == 0)
                num = 0;
            else if (size == 4)
            {
                byte[] floatBytes = reader.ReadBytes(4);
                Array.Reverse(floatBytes);
                num = BitConverter.ToSingle(floatBytes, 0);
            }
            else if (size == 8)
            {
                byte[] dBytes = reader.ReadBytes(8);
                Array.Reverse(dBytes);
                num = BitConverter.ToDouble(dBytes, 0);
            }
            else
                throw new ArgumentException("Invalid size");
            return 0;
        }