SwapUInt16() public static method

public static SwapUInt16 ( ushort v ) : ushort
v ushort
return ushort
コード例 #1
0
        /// <summary>
        /// Reads a ushort from the underlying stream.
        /// </summary>
        /// <returns>A ushort.</returns>
        public ushort ReadUShort()
        {
            lock (m_Reader)
            {
                if (Endian.IsBigEndian != m_IsBigEndian)
                {
                    return(Endian.SwapUInt16(m_Reader.ReadUInt16()));
                }

                return(m_Reader.ReadUInt16());
            }
        }
コード例 #2
0
        /// <summary>
        /// Writes a short to the underlying stream.
        /// </summary>
        public void WriteUInt16(ushort Val)
        {
            lock (m_Writer)
            {
                if (Endian.IsBigEndian != m_IsBigEndian)
                {
                    Endian.SwapUInt16(Val);
                    m_Writer.Write(Val);
                    return;
                }

                m_Writer.Write(Val);
            }
        }