public static void SetBytes(this byte[] instance, int offset, long value) { Contract.Requires(instance != null); instance[offset++] = (byte)value; instance[offset++] = (byte)(value >> 8); instance[offset++] = (byte)(value >> 0x10); instance[offset++] = (byte)(value >> 0x18); instance[offset++] = (byte)(value >> 0x20); instance[offset++] = (byte)(value >> 40); instance[offset++] = (byte)(value >> 0x30); instance[offset] = (byte)(value >> 0x38); } public static long ToInt64(this byte[] instance, int offset) { Contract.Requires(instance != null); uint num = (uint)(((instance[offset++] | (instance[offset++] << 8)) | (instance[offset++] << 0x10)) | (instance[offset++] << 0x18)); uint num2 = (uint)(((instance[offset++] | (instance[offset++] << 8)) | (instance[offset++] << 0x10)) | (instance[offset] << 0x18)); return (long)((num2 << 0x20) | num); }
public static void SetBytes(this byte[] instance, int offset, int value) { Contract.Requires(instance != null); instance[offset++] = (byte)(value); instance[offset++] = (byte)(value >> 8); instance[offset++] = (byte)(value >> 16); instance[offset] = (byte)(value >> 24); } public static int ToInt32(this byte[] instance, int offset) { Contract.Requires(instance != null); return (int)(instance[offset++] | instance[offset++] << 8 | instance[offset++] << 16 | instance[offset] << 24); }