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

◆ ComposeBitsBytesChain()

static BitsByte[] Terraria.BitsByte.ComposeBitsBytesChain ( bool optimizeLength,
params bool[] flags )
inlinestatic

Definition at line 114 of file BitsByte.cs.

115 {
116 int num = flags.Length;
117 int num2 = 0;
118 while (num > 0)
119 {
120 num2++;
121 num -= 7;
122 }
123 BitsByte[] array = new BitsByte[num2];
124 int num3 = 0;
125 int num4 = 0;
126 for (int i = 0; i < flags.Length; i++)
127 {
128 array[num4][num3] = flags[i];
129 num3++;
130 if (num3 == 7 && num4 < num2 - 1)
131 {
132 array[num4][num3] = true;
133 num3 = 0;
134 num4++;
135 }
136 }
137 if (optimizeLength)
138 {
139 int num5 = array.Length - 1;
140 while ((byte)array[num5] == 0 && num5 > 0)
141 {
142 array[num5 - 1][7] = false;
143 num5--;
144 }
145 Array.Resize(ref array, num5 + 1);
146 }
147 return array;
148 }
BitsByte(bool b1=false, bool b2=false, bool b3=false, bool b4=false, bool b5=false, bool b6=false, bool b7=false, bool b8=false)
Definition BitsByte.cs:32

References System.array.