コード例 #1
0
        public static byte[] GetInt64Bytes(Int64 value, FFEndianType endian)
        {
            FFInt64 ffValue = new FFInt64()
            {
                Value = value
            };

            byte[] result = new byte[8];

            if ((endian == FFEndianType.BigEndian && SystemEndianType == FFEndianType.LittleEndian) ||
                (endian == FFEndianType.LittleEndian && SystemEndianType == FFEndianType.BigEndian))
            {
                result[0] = ffValue.Value8;
                result[1] = ffValue.Value7;
                result[2] = ffValue.Value6;
                result[3] = ffValue.Value5;
                result[4] = ffValue.Value4;
                result[5] = ffValue.Value3;
                result[6] = ffValue.Value2;
                result[7] = ffValue.Value1;
            }
            else
            {
                result[0] = ffValue.Value1;
                result[1] = ffValue.Value2;
                result[2] = ffValue.Value3;
                result[3] = ffValue.Value4;
                result[4] = ffValue.Value5;
                result[5] = ffValue.Value6;
                result[6] = ffValue.Value7;
                result[7] = ffValue.Value8;
            }
            return(result);
        }
コード例 #2
0
        public static Int64 GetInt64(byte[] value, FFEndianType endian, int offset, int length)
        {
            FFInt64 ffValue = new FFInt64();

            if (endian == FFEndianType.BigEndian)
            {
                ffValue.Value1 = value[0];
                ffValue.Value2 = value[1];
                ffValue.Value3 = value[2];
                ffValue.Value4 = value[3];
                ffValue.Value5 = value[4];
                ffValue.Value6 = value[5];
                ffValue.Value7 = value[6];
                ffValue.Value8 = value[7];
            }
            else
            {
                ffValue.Value1 = value[7];
                ffValue.Value2 = value[6];
                ffValue.Value3 = value[5];
                ffValue.Value4 = value[4];
                ffValue.Value5 = value[3];
                ffValue.Value6 = value[2];
                ffValue.Value7 = value[1];
                ffValue.Value8 = value[0];
            }
            return(ffValue.Value);
        }
コード例 #3
0
        public static byte[] GetInt64Bytes(Int64 value, FFEndianType endian)
        {
            FFInt64 ffValue = new FFInt64() { Value = value };
            byte[] result = new byte[8];

            if ((endian == FFEndianType.BigEndian && SystemEndianType == FFEndianType.LittleEndian) ||
                (endian == FFEndianType.LittleEndian && SystemEndianType == FFEndianType.BigEndian))
            {
                result[0] = ffValue.Value8;
                result[1] = ffValue.Value7;
                result[2] = ffValue.Value6;
                result[3] = ffValue.Value5;
                result[4] = ffValue.Value4;
                result[5] = ffValue.Value3;
                result[6] = ffValue.Value2;
                result[7] = ffValue.Value1;
            }
            else
            {
                result[0] = ffValue.Value1;
                result[1] = ffValue.Value2;
                result[2] = ffValue.Value3;
                result[3] = ffValue.Value4;
                result[4] = ffValue.Value5;
                result[5] = ffValue.Value6;
                result[6] = ffValue.Value7;
                result[7] = ffValue.Value8;
            }
            return result;
        }
コード例 #4
0
 public static Int64 GetInt64(byte[] value, FFEndianType endian, int offset, int length)
 {
     FFInt64 ffValue = new FFInt64();
     if (endian == FFEndianType.BigEndian)
     {
         ffValue.Value1 = value[0];
         ffValue.Value2 = value[1];
         ffValue.Value3 = value[2];
         ffValue.Value4 = value[3];
         ffValue.Value5 = value[4];
         ffValue.Value6 = value[5];
         ffValue.Value7 = value[6];
         ffValue.Value8 = value[7];
     }
     else
     {
         ffValue.Value1 = value[7];
         ffValue.Value2 = value[6];
         ffValue.Value3 = value[5];
         ffValue.Value4 = value[4];
         ffValue.Value5 = value[3];
         ffValue.Value6 = value[2];
         ffValue.Value7 = value[1];
         ffValue.Value8 = value[0];
     }
     return ffValue.Value;
 }