SwapInt16() public static method

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

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

                m_Writer.Write(Val);
            }
        }