Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ BitArray() [3/6]

System.Collections.BitArray.BitArray ( byte[] bytes)
inline

Definition at line 165 of file BitArray.cs.

166 {
167 if (bytes == null)
168 {
169 throw new ArgumentNullException("bytes");
170 }
171 if (bytes.Length > 268435455)
172 {
174 }
176 m_length = bytes.Length * 8;
177 uint num = (uint)bytes.Length / 4u;
178 ReadOnlySpan<byte> source = bytes;
179 for (int i = 0; i < num; i++)
180 {
182 source = source.Slice(4);
183 }
184 int num2 = 0;
185 switch (source.Length)
186 {
187 case 3:
188 num2 = source[2] << 16;
189 goto case 2;
190 case 2:
191 num2 |= source[1] << 8;
192 goto case 1;
193 case 1:
194 m_array[num] = num2 | source[0];
195 break;
196 }
197 _version = 0;
198 }
static int ReadInt32LittleEndian(ReadOnlySpan< byte > source)
static int GetInt32ArrayLengthFromByteLength(int n)
Definition BitArray.cs:993
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Argument_ArrayTooLarge
Definition SR.cs:52
Definition SR.cs:7

References System.Collections.BitArray._version, System.SR.Argument_ArrayTooLarge, System.bytes, System.SR.Format(), System.Collections.BitArray.GetInt32ArrayLengthFromByteLength(), System.Collections.BitArray.m_array, System.Collections.BitArray.m_length, System.Buffers.Binary.BinaryPrimitives.ReadInt32LittleEndian(), and System.source.