Пример #1
0
        // Write floating-point values to the output.
        public virtual void Write(float value)
        {
            int bits = BitConverter.FloatToInt32Bits(value);

            if (BitConverter.IsLittleEndian)
            {
                smallBuffer[0] = (byte)bits;
                smallBuffer[1] = (byte)(bits >> 8);
                smallBuffer[2] = (byte)(bits >> 16);
                smallBuffer[3] = (byte)(bits >> 24);
            }
            else
            {
                smallBuffer[3] = (byte)bits;
                smallBuffer[2] = (byte)(bits >> 8);
                smallBuffer[1] = (byte)(bits >> 16);
                smallBuffer[0] = (byte)(bits >> 24);
            }
            WriteBuffer(4);
        }