public static byte[] GetUInt64Bytes(UInt64 value, FFEndianType endian) { FFUInt64 ffValue = new FFUInt64() { 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); }
public static UInt64 GetUInt64(byte[] value, FFEndianType endian, int offset, int length) { FFUInt64 ffValue = new FFUInt64(); 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); }
public static byte[] GetUInt64Bytes(UInt64 value, FFEndianType endian) { FFUInt64 ffValue = new FFUInt64() { 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; }
public static UInt64 GetUInt64(byte[] value, FFEndianType endian, int offset, int length) { FFUInt64 ffValue = new FFUInt64(); 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; }