using System; using System.Text; namespace System.Collections.Specialized { /// Provides a simple structure that stores Boolean values and small integers in 32 bits of memory. // Token: 0x02000025 RID: 37 public struct BitVector32 { /// Initializes a new instance of the structure containing the data represented in an existing structure. /// A structure that contains the data to copy. // Token: 0x06000174 RID: 372 RVA: 0x0000689C File Offset: 0x00004A9C public BitVector32(BitVector32 source) { this.bits = source.bits; } /// Initializes a new instance of the structure containing the data represented in an integer. /// An integer representing the data of the new . // Token: 0x06000175 RID: 373 RVA: 0x000068AC File Offset: 0x00004AAC public BitVector32(int init) { this.bits = init; } /// Gets the value of the as an integer. /// The value of the as an integer. // Token: 0x17000063 RID: 99 // (get) Token: 0x06000176 RID: 374 RVA: 0x000068B8 File Offset: 0x00004AB8 public int Data { get { return this.bits; } } /// Gets or sets the value stored in the specified . /// The value stored in the specified . /// A that contains the value to get or set. // Token: 0x17000064 RID: 100 public int this[BitVector32.Section section] { get { return (this.bits >> (int)section.Offset) & (int)section.Mask; } set { if (value < 0) { throw new ArgumentException("Section can't hold negative values"); } if (value > (int)section.Mask) { throw new ArgumentException("Value too large to fit in section"); } this.bits &= ~((int)section.Mask << (int)section.Offset); this.bits |= value << (int)section.Offset; } } /// Gets or sets the state of the bit flag indicated by the specified mask. /// true if the specified bit flag is on (1); otherwise, false. /// A mask that indicates the bit to get or set. // Token: 0x17000065 RID: 101 public bool this[int mask] { get { return (this.bits & mask) == mask; } set { if (value) { this.bits |= mask; } else { this.bits &= ~mask; } } } /// Creates the first mask in a series of masks that can be used to retrieve individual bits in a that is set up as bit flags. /// A mask that isolates the first bit flag in the . /// /// /// // Token: 0x0600017B RID: 379 RVA: 0x0000699C File Offset: 0x00004B9C public static int CreateMask() { return 1; } /// Creates an additional mask following the specified mask in a series of masks that can be used to retrieve individual bits in a that is set up as bit flags. /// A mask that isolates the bit flag following the one that points to in . /// The mask that indicates the previous bit flag. /// /// indicates the last bit flag in the . // Token: 0x0600017C RID: 380 RVA: 0x000069A0 File Offset: 0x00004BA0 public static int CreateMask(int prev) { if (prev == 0) { return 1; } if (prev == -2147483648) { throw new InvalidOperationException("all bits set"); } return prev << 1; } /// Creates the first in a series of sections that contain small integers. /// A that can hold a number from zero to . /// A 16-bit signed integer that specifies the maximum value for the new . /// /// is less than 1. // Token: 0x0600017D RID: 381 RVA: 0x000069C4 File Offset: 0x00004BC4 public static BitVector32.Section CreateSection(short maxValue) { return BitVector32.CreateSection(maxValue, new BitVector32.Section(0, 0)); } /// Creates a new following the specified in a series of sections that contain small integers. /// A that can hold a number from zero to . /// A 16-bit signed integer that specifies the maximum value for the new . /// The previous in the . /// /// is less than 1. /// /// includes the final bit in the .-or- is greater than the highest value that can be represented by the number of bits after . // Token: 0x0600017E RID: 382 RVA: 0x000069D4 File Offset: 0x00004BD4 public static BitVector32.Section CreateSection(short maxValue, BitVector32.Section previous) { if (maxValue < 1) { throw new ArgumentException("maxValue"); } int num = BitVector32.HighestSetBit((int)maxValue); int num2 = (1 << num) - 1; int num3 = (int)previous.Offset + BitVector32.HighestSetBit((int)previous.Mask); if (num3 + num > 32) { throw new ArgumentException("Sections cannot exceed 32 bits in total"); } return new BitVector32.Section((short)num2, (short)num3); } /// Determines whether the specified object is equal to the . /// true if the specified object is equal to the ; otherwise, false. /// The object to compare with the current . // Token: 0x0600017F RID: 383 RVA: 0x00006A38 File Offset: 0x00004C38 public override bool Equals(object o) { return o is BitVector32 && this.bits == ((BitVector32)o).bits; } /// Serves as a hash function for the . /// A hash code for the . // Token: 0x06000180 RID: 384 RVA: 0x00006A6C File Offset: 0x00004C6C public override int GetHashCode() { return this.bits.GetHashCode(); } /// Returns a string that represents the current . /// A string that represents the current . // Token: 0x06000181 RID: 385 RVA: 0x00006A7C File Offset: 0x00004C7C public override string ToString() { return BitVector32.ToString(this); } /// Returns a string that represents the specified . /// A string that represents the specified . /// The to represent. // Token: 0x06000182 RID: 386 RVA: 0x00006A8C File Offset: 0x00004C8C public static string ToString(BitVector32 value) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("BitVector32{"); for (long num = (long)((ulong)int.MinValue); num > 0L; num >>= 1) { stringBuilder.Append((((long)value.bits & num) != 0L) ? '1' : '0'); } stringBuilder.Append('}'); return stringBuilder.ToString(); } // Token: 0x06000183 RID: 387 RVA: 0x00006AF4 File Offset: 0x00004CF4 private static int HighestSetBit(int i) { int num = 0; while (i >> num != 0) { num++; } return num; } // Token: 0x0400007F RID: 127 private int bits; /// Represents a section of the vector that can contain an integer number. // Token: 0x02000026 RID: 38 public struct Section { // Token: 0x06000184 RID: 388 RVA: 0x00006B18 File Offset: 0x00004D18 internal Section(short mask, short offset) { this.mask = mask; this.offset = offset; } /// Gets a mask that isolates this section within the . /// A mask that isolates this section within the . // Token: 0x17000066 RID: 102 // (get) Token: 0x06000185 RID: 389 RVA: 0x00006B28 File Offset: 0x00004D28 public short Mask { get { return this.mask; } } /// Gets the offset of this section from the start of the . /// The offset of this section from the start of the . // Token: 0x17000067 RID: 103 // (get) Token: 0x06000186 RID: 390 RVA: 0x00006B30 File Offset: 0x00004D30 public short Offset { get { return this.offset; } } /// Determines whether the specified object is the same as the current object. /// true if the parameter is the same as the current object; otherwise false. /// The object to compare with the current object. // Token: 0x06000187 RID: 391 RVA: 0x00006B38 File Offset: 0x00004D38 public bool Equals(BitVector32.Section obj) { return this.mask == obj.mask && this.offset == obj.offset; } /// Determines whether the specified object is the same as the current object. /// true if the specified object is the same as the current object; otherwise, false. /// The object to compare with the current . // Token: 0x06000188 RID: 392 RVA: 0x00006B6C File Offset: 0x00004D6C public override bool Equals(object o) { if (!(o is BitVector32.Section)) { return false; } BitVector32.Section section = (BitVector32.Section)o; return this.mask == section.mask && this.offset == section.offset; } /// Serves as a hash function for the current , suitable for hashing algorithms and data structures, such as a hash table. /// A hash code for the current . // Token: 0x06000189 RID: 393 RVA: 0x00006BB4 File Offset: 0x00004DB4 public override int GetHashCode() { return (int)this.mask << (int)this.offset; } /// Returns a string that represents the current . /// A string that represents the current . // Token: 0x0600018A RID: 394 RVA: 0x00006BC8 File Offset: 0x00004DC8 public override string ToString() { return BitVector32.Section.ToString(this); } /// Returns a string that represents the specified . /// A string that represents the specified . /// The to represent. // Token: 0x0600018B RID: 395 RVA: 0x00006BD8 File Offset: 0x00004DD8 public static string ToString(BitVector32.Section value) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("Section{0x"); stringBuilder.Append(Convert.ToString(value.Mask, 16)); stringBuilder.Append(", 0x"); stringBuilder.Append(Convert.ToString(value.Offset, 16)); stringBuilder.Append("}"); return stringBuilder.ToString(); } /// Determines whether two specified objects are equal. /// true if the and parameters represent the same object, otherwise, false. /// A object. /// A object. // Token: 0x0600018C RID: 396 RVA: 0x00006C40 File Offset: 0x00004E40 public static bool operator ==(BitVector32.Section v1, BitVector32.Section v2) { return v1.mask == v2.mask && v1.offset == v2.offset; } /// Determines whether two objects have different values. /// true if the and parameters represent different objects; otherwise, false. /// A object. /// A object. // Token: 0x0600018D RID: 397 RVA: 0x00006C74 File Offset: 0x00004E74 public static bool operator !=(BitVector32.Section v1, BitVector32.Section v2) { return v1.mask != v2.mask || v1.offset != v2.offset; } // Token: 0x04000080 RID: 128 private short mask; // Token: 0x04000081 RID: 129 private short offset; } } }