◆ Bin8()
BrawlLib.Internal.Bin8.Bin8 |
( |
byte |
val | ) |
|
|
inline |
347 {
349 }
byte _data
Definition: BinaryHandlers.cs:344
◆ FromString()
static Bin8 BrawlLib.Internal.Bin8.FromString |
( |
string |
s | ) |
|
|
inlinestatic |
426 {
427 char[] delims = new char[] {',', '(', ')', ' '};
428
429 byte b = 0;
430 string[] arr = s.Split(delims, StringSplitOptions.RemoveEmptyEntries);
431
432 for (int len = 0; len < arr.Length; len++)
433 {
434 byte bit = 0;
435 for (int i = 0; i < arr[len].Length; i++)
436 {
437 b <<= 1;
438 byte.TryParse(arr[len][i].
ToString(), out bit);
439 bit = bit.Clamp(0, 1);
440 b += bit;
441 }
442 }
443
445 }
Bin8(byte val)
Definition: BinaryHandlers.cs:346
override string ToString()
Definition: BinaryHandlers.cs:363
◆ operator Bin8()
static implicit BrawlLib.Internal.Bin8.operator Bin8 |
( |
byte |
val | ) |
|
|
inlinestatic |
357 {
358 return new Bin8(val);
359 }
◆ operator byte()
static implicit BrawlLib.Internal.Bin8.operator byte |
( |
Bin8 |
val | ) |
|
|
inlinestatic |
352 {
353 return val._data;
354 }
◆ ToString()
override string BrawlLib.Internal.Bin8.ToString |
( |
| ) |
|
|
inline |
364 {
365 int i = 0;
366 string val = "";
367 while (i++ < 8)
368 {
369 val += (
_data >> (8 - i)) & 1;
370 if (i % 4 == 0 && i != 8)
371 {
372 val += " ";
373 }
374 }
375
376 return val;
377 }
◆ _data
byte BrawlLib.Internal.Bin8._data |
◆ this[int index]
bool BrawlLib.Internal.Bin8.this[int index] |
|
getset |
380 {
381 get => ((
_data >> index) & 1) != 0;
382 set
383 {
384 if (value)
385 {
386 _data |= (byte) (1 << index);
387 }
388 else
389 {
390 _data &= (byte) ~(1 << index);
391 }
392 }
393 }
◆ this[int shift, int bitCount]
byte BrawlLib.Internal.Bin8.this[int shift, int bitCount] |
|
getset |
402 {
403 get
404 {
405 int mask = 0;
406 for (int i = 0; i < bitCount; i++)
407 {
408 mask |= 1 << i;
409 }
410
411 return (
byte) ((
_data >> shift) & mask);
412 }
413 set
414 {
415 int mask = 0;
416 for (int i = 0; i < bitCount; i++)
417 {
418 mask |= 1 << i;
419 }
420
421 _data = (byte) ((
_data & ~(mask << shift)) | ((value & mask) << shift));
422 }
423 }
The documentation for this struct was generated from the following file:
- BrawlLib/Internal/BinaryHandlers.cs