◆ Bin16()
BrawlLib.Internal.Bin16.Bin16 |
( |
ushort |
val | ) |
|
|
inline |
240 {
242 }
bushort _data
Definition: BinaryHandlers.cs:237
◆ FromString()
static Bin16 BrawlLib.Internal.Bin16.FromString |
( |
string |
s | ) |
|
|
inlinestatic |
319 {
320 char[] delims = new char[] {',', '(', ')', ' '};
321
322 ushort b = 0;
323 string[] arr = s.Split(delims, StringSplitOptions.RemoveEmptyEntries);
324
325 for (int len = 0; len < arr.Length; len++)
326 {
327 byte bit = 0;
328 for (int i = 0; i < arr[len].Length; i++)
329 {
330 b <<= 1;
331 byte.TryParse(arr[len][i].
ToString(), out bit);
332 bit = bit.Clamp(0, 1);
333 b += bit;
334 }
335 }
336
338 }
override string ToString()
Definition: BinaryHandlers.cs:256
Bin16(ushort val)
Definition: BinaryHandlers.cs:239
◆ operator Bin16()
static implicit BrawlLib.Internal.Bin16.operator Bin16 |
( |
ushort |
val | ) |
|
|
inlinestatic |
250 {
251 return new Bin16(val);
252 }
◆ operator ushort()
static implicit BrawlLib.Internal.Bin16.operator ushort |
( |
Bin16 |
val | ) |
|
|
inlinestatic |
245 {
246 return val._data;
247 }
◆ ToString()
override string BrawlLib.Internal.Bin16.ToString |
( |
| ) |
|
|
inline |
257 {
258 int i = 0;
259 string val = "";
260 while (i++ < 16)
261 {
262 val += (
_data >> (16 - i)) & 1;
263 if (i % 4 == 0 && i != 16)
264 {
265 val += " ";
266 }
267 }
268
269 return val;
270 }
◆ _data
bushort BrawlLib.Internal.Bin16._data |
◆ this[int index]
bool BrawlLib.Internal.Bin16.this[int index] |
|
getset |
273 {
274 get => ((
_data >> index) & 1) != 0;
275 set
276 {
277 if (value)
278 {
279 _data = (ushort) (
_data | (ushort) (1 << index));
280 }
281 else
282 {
283 _data = (ushort) (
_data & ~(ushort) (1 << index));
284 }
285 }
286 }
◆ this[int shift, int bitCount]
ushort BrawlLib.Internal.Bin16.this[int shift, int bitCount] |
|
getset |
295 {
296 get
297 {
298 int mask = 0;
299 for (int i = 0; i < bitCount; i++)
300 {
301 mask |= 1 << i;
302 }
303
304 return (ushort) ((
_data >> shift) & mask);
305 }
306 set
307 {
308 int mask = 0;
309 for (int i = 0; i < bitCount; i++)
310 {
311 mask |= 1 << i;
312 }
313
314 _data = (ushort) ((
_data & ~(mask << shift)) | ((value & mask) << shift));
315 }
316 }
The documentation for this struct was generated from the following file:
- BrawlLib/Internal/BinaryHandlers.cs