BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
BrawlLib.Internal.Bin24 Struct Reference

Public Member Functions

 Bin24 (BUInt24 val)
 
override string ToString ()
 

Static Public Member Functions

static implicit operator int (Bin24 val)
 
static implicit operator uint (Bin24 val)
 
static implicit operator Bin24 (uint val)
 
static implicit operator BUInt24 (Bin24 val)
 
static implicit operator Bin24 (BUInt24 val)
 
static Bin24 FromString (string s)
 

Public Attributes

BUInt24 _data
 

Properties

bool this[int index] [get, set]
 
int this[int shift, int bitCount] [get, set]
 

Constructor & Destructor Documentation

◆ Bin24()

BrawlLib.Internal.Bin24.Bin24 ( BUInt24  val)
inline
119 {
120 _data = val;
121 }
BUInt24 _data
Definition: BinaryHandlers.cs:116

Member Function Documentation

◆ FromString()

static Bin24 BrawlLib.Internal.Bin24.FromString ( string  s)
inlinestatic
212 {
213 char[] delims = new char[] {',', '(', ')', ' '};
214
215 uint b = 0;
216 string[] arr = s.Split(delims, StringSplitOptions.RemoveEmptyEntries);
217
218 for (int len = 0; len < arr.Length; len++)
219 {
220 byte bit = 0;
221 for (int i = 0; i < arr[len].Length; i++)
222 {
223 b <<= 1;
224 byte.TryParse(arr[len][i].ToString(), out bit);
225 bit = bit.Clamp(0, 1);
226 b += bit;
227 }
228 }
229
230 return new Bin24(b);
231 }
override string ToString()
Definition: BinaryHandlers.cs:148
Bin24(BUInt24 val)
Definition: BinaryHandlers.cs:118

◆ operator Bin24() [1/2]

static implicit BrawlLib.Internal.Bin24.operator Bin24 ( BUInt24  val)
inlinestatic
144 {
145 return new Bin24(val);
146 }

◆ operator Bin24() [2/2]

static implicit BrawlLib.Internal.Bin24.operator Bin24 ( uint  val)
inlinestatic
134 {
135 return new Bin24(val);
136 }

◆ operator BUInt24()

static implicit BrawlLib.Internal.Bin24.operator BUInt24 ( Bin24  val)
inlinestatic
139 {
140 return val._data;
141 }

◆ operator int()

static implicit BrawlLib.Internal.Bin24.operator int ( Bin24  val)
inlinestatic
124 {
125 return val._data;
126 }

◆ operator uint()

static implicit BrawlLib.Internal.Bin24.operator uint ( Bin24  val)
inlinestatic
129 {
130 return val._data;
131 }

◆ ToString()

override string BrawlLib.Internal.Bin24.ToString ( )
inline
149 {
150 int i = 0;
151 string val = "";
152 uint data = _data;
153 while (i++ < 24)
154 {
155 val += (data >> (24 - i)) & 1;
156 if (i % 4 == 0 && i != 24)
157 {
158 val += " ";
159 }
160 }
161
162 return val;
163 }

Member Data Documentation

◆ _data

BUInt24 BrawlLib.Internal.Bin24._data

Property Documentation

◆ this[int index]

bool BrawlLib.Internal.Bin24.this[int index]
getset
166 {
167 get => (((uint) _data >> index) & 1) != 0;
168 set
169 {
170 if (value)
171 {
172 _data = _data | (uint) (1 << index);
173 }
174 else
175 {
176 _data = _data & ~(uint) (1 << index);
177 }
178 }
179 }

◆ this[int shift, int bitCount]

int BrawlLib.Internal.Bin24.this[int shift, int bitCount]
getset
188 {
189 get
190 {
191 int mask = 0;
192 for (int i = 0; i < bitCount; i++)
193 {
194 mask |= 1 << i;
195 }
196
197 return (int) (((uint) _data >> shift) & mask);
198 }
199 set
200 {
201 int mask = 0;
202 for (int i = 0; i < bitCount; i++)
203 {
204 mask |= 1 << i;
205 }
206
207 _data = (uint) (((uint) _data & ~(mask << shift)) | (((uint) value & mask) << shift));
208 }
209 }

The documentation for this struct was generated from the following file: