コード例 #1
0
        /// <summary>
        /// 将倒序的ushort字节还原为ushort
        /// </summary>
        /// <param name="buffer"></param>
        /// <param name="start"></param>
        /// <returns></returns>
        internal static ushort GetSwappedUshort(byte[] buffer, int start)
        {
            byte[] tmp = new byte[2];
            tmp[0] = buffer[start];
            tmp[1] = buffer[start + 1];

            return(BitConverter.ToUInt16(BytesTools.SwapBytes(tmp), 0));
        }
コード例 #2
0
 /// <summary>
 /// 将倒序的uint字节还原为uint
 /// </summary>
 /// <param name="buffer"></param>
 /// <param name="start"></param>
 /// <returns></returns>
 internal static uint GetSwappedUint(byte[] buffer, int start)
 {
     byte[] tmp = BytesTools.SubBuffer(buffer, start, 4);
     return(BitConverter.ToUInt32(BytesTools.SwapBytes(tmp), 0));
 }