Ejemplo n.º 1
0
        public static long GetLong(byte[] src, int startIndex)
        {
            long result = BitConverter.ToInt64(src, startIndex);

            if (ByteBufferUtil.IsReveresed(_endian))
            {
                return(result.Reverse());
            }
            return(result);
        }
Ejemplo n.º 2
0
        public static short GetShort(byte[] src, int startIndex)
        {
            short result = BitConverter.ToInt16(src, startIndex);

            if (ByteBufferUtil.IsReveresed(_endian))
            {
                return(result.Reverse());
            }
            return(result);
        }
Ejemplo n.º 3
0
        public static float GetFloat(byte[] src, int startIndex)
        {
            float result = BitConverter.ToSingle(src, startIndex);

            if (ByteBufferUtil.IsReveresed(_endian))
            {
                return(result.Reverse());
            }
            return(result);
        }
Ejemplo n.º 4
0
        public static void SetFloat(byte[] dst, ref int startIndex, float value)
        {
            byte[] src = BitConverter.GetBytes(value);

            if (ByteBufferUtil.IsReveresed(_endian))
            {
                Array.Reverse(src);
            }
            ByteBufferUtil.Copy(src, 0, dst, startIndex, src.Length);

            startIndex += sizeof(float);
        }