using System; namespace Mono.Security { // Token: 0x020000DC RID: 220 internal sealed class BitConverterLE { // Token: 0x06000AF5 RID: 2805 RVA: 0x00030B00 File Offset: 0x0002ED00 private BitConverterLE() { } // Token: 0x06000AF6 RID: 2806 RVA: 0x00030B08 File Offset: 0x0002ED08 private unsafe static byte[] GetUShortBytes(byte* bytes) { if (BitConverter.IsLittleEndian) { return new byte[] { *bytes, bytes[1] }; } return new byte[] { bytes[1], *bytes }; } // Token: 0x06000AF7 RID: 2807 RVA: 0x00030B3C File Offset: 0x0002ED3C private unsafe static byte[] GetUIntBytes(byte* bytes) { if (BitConverter.IsLittleEndian) { return new byte[] { *bytes, bytes[1], bytes[2], bytes[3] }; } return new byte[] { bytes[3], bytes[2], bytes[1], *bytes }; } // Token: 0x06000AF8 RID: 2808 RVA: 0x00030B94 File Offset: 0x0002ED94 private unsafe static byte[] GetULongBytes(byte* bytes) { if (BitConverter.IsLittleEndian) { return new byte[] { *bytes, bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7] }; } return new byte[] { bytes[7], bytes[6], bytes[5], bytes[4], bytes[3], bytes[2], bytes[1], *bytes }; } // Token: 0x06000AF9 RID: 2809 RVA: 0x00030C24 File Offset: 0x0002EE24 internal static byte[] GetBytes(bool value) { return new byte[] { (!value) ? 0 : 1 }; } // Token: 0x06000AFA RID: 2810 RVA: 0x00030C3C File Offset: 0x0002EE3C internal unsafe static byte[] GetBytes(char value) { return BitConverterLE.GetUShortBytes((byte*)(&value)); } // Token: 0x06000AFB RID: 2811 RVA: 0x00030C48 File Offset: 0x0002EE48 internal unsafe static byte[] GetBytes(short value) { return BitConverterLE.GetUShortBytes((byte*)(&value)); } // Token: 0x06000AFC RID: 2812 RVA: 0x00030C54 File Offset: 0x0002EE54 internal unsafe static byte[] GetBytes(int value) { return BitConverterLE.GetUIntBytes((byte*)(&value)); } // Token: 0x06000AFD RID: 2813 RVA: 0x00030C60 File Offset: 0x0002EE60 internal unsafe static byte[] GetBytes(long value) { return BitConverterLE.GetULongBytes((byte*)(&value)); } // Token: 0x06000AFE RID: 2814 RVA: 0x00030C6C File Offset: 0x0002EE6C internal unsafe static byte[] GetBytes(ushort value) { return BitConverterLE.GetUShortBytes((byte*)(&value)); } // Token: 0x06000AFF RID: 2815 RVA: 0x00030C78 File Offset: 0x0002EE78 internal unsafe static byte[] GetBytes(uint value) { return BitConverterLE.GetUIntBytes((byte*)(&value)); } // Token: 0x06000B00 RID: 2816 RVA: 0x00030C84 File Offset: 0x0002EE84 internal unsafe static byte[] GetBytes(ulong value) { return BitConverterLE.GetULongBytes((byte*)(&value)); } // Token: 0x06000B01 RID: 2817 RVA: 0x00030C90 File Offset: 0x0002EE90 internal unsafe static byte[] GetBytes(float value) { return BitConverterLE.GetUIntBytes((byte*)(&value)); } // Token: 0x06000B02 RID: 2818 RVA: 0x00030C9C File Offset: 0x0002EE9C internal unsafe static byte[] GetBytes(double value) { return BitConverterLE.GetULongBytes((byte*)(&value)); } // Token: 0x06000B03 RID: 2819 RVA: 0x00030CA8 File Offset: 0x0002EEA8 private unsafe static void UShortFromBytes(byte* dst, byte[] src, int startIndex) { if (BitConverter.IsLittleEndian) { *dst = src[startIndex]; dst[1] = src[startIndex + 1]; } else { *dst = src[startIndex + 1]; dst[1] = src[startIndex]; } } // Token: 0x06000B04 RID: 2820 RVA: 0x00030CD8 File Offset: 0x0002EED8 private unsafe static void UIntFromBytes(byte* dst, byte[] src, int startIndex) { if (BitConverter.IsLittleEndian) { *dst = src[startIndex]; dst[1] = src[startIndex + 1]; dst[2] = src[startIndex + 2]; dst[3] = src[startIndex + 3]; } else { *dst = src[startIndex + 3]; dst[1] = src[startIndex + 2]; dst[2] = src[startIndex + 1]; dst[3] = src[startIndex]; } } // Token: 0x06000B05 RID: 2821 RVA: 0x00030D34 File Offset: 0x0002EF34 private unsafe static void ULongFromBytes(byte* dst, byte[] src, int startIndex) { if (BitConverter.IsLittleEndian) { for (int i = 0; i < 8; i++) { dst[i] = src[startIndex + i]; } } else { for (int j = 0; j < 8; j++) { dst[j] = src[startIndex + (7 - j)]; } } } // Token: 0x06000B06 RID: 2822 RVA: 0x00030D88 File Offset: 0x0002EF88 internal static bool ToBoolean(byte[] value, int startIndex) { return value[startIndex] != 0; } // Token: 0x06000B07 RID: 2823 RVA: 0x00030D94 File Offset: 0x0002EF94 internal unsafe static char ToChar(byte[] value, int startIndex) { char c; BitConverterLE.UShortFromBytes((byte*)(&c), value, startIndex); return c; } // Token: 0x06000B08 RID: 2824 RVA: 0x00030DAC File Offset: 0x0002EFAC internal unsafe static short ToInt16(byte[] value, int startIndex) { short num; BitConverterLE.UShortFromBytes((byte*)(&num), value, startIndex); return num; } // Token: 0x06000B09 RID: 2825 RVA: 0x00030DC4 File Offset: 0x0002EFC4 internal unsafe static int ToInt32(byte[] value, int startIndex) { int num; BitConverterLE.UIntFromBytes((byte*)(&num), value, startIndex); return num; } // Token: 0x06000B0A RID: 2826 RVA: 0x00030DDC File Offset: 0x0002EFDC internal unsafe static long ToInt64(byte[] value, int startIndex) { long num; BitConverterLE.ULongFromBytes((byte*)(&num), value, startIndex); return num; } // Token: 0x06000B0B RID: 2827 RVA: 0x00030DF4 File Offset: 0x0002EFF4 internal unsafe static ushort ToUInt16(byte[] value, int startIndex) { ushort num; BitConverterLE.UShortFromBytes((byte*)(&num), value, startIndex); return num; } // Token: 0x06000B0C RID: 2828 RVA: 0x00030E0C File Offset: 0x0002F00C internal unsafe static uint ToUInt32(byte[] value, int startIndex) { uint num; BitConverterLE.UIntFromBytes((byte*)(&num), value, startIndex); return num; } // Token: 0x06000B0D RID: 2829 RVA: 0x00030E24 File Offset: 0x0002F024 internal unsafe static ulong ToUInt64(byte[] value, int startIndex) { ulong num; BitConverterLE.ULongFromBytes((byte*)(&num), value, startIndex); return num; } // Token: 0x06000B0E RID: 2830 RVA: 0x00030E3C File Offset: 0x0002F03C internal unsafe static float ToSingle(byte[] value, int startIndex) { float num; BitConverterLE.UIntFromBytes((byte*)(&num), value, startIndex); return num; } // Token: 0x06000B0F RID: 2831 RVA: 0x00030E54 File Offset: 0x0002F054 internal unsafe static double ToDouble(byte[] value, int startIndex) { double num; BitConverterLE.ULongFromBytes((byte*)(&num), value, startIndex); return num; } } }