Example #1
0
 private static int DetermineIndex(PrefixByte input)
 {
     if (input == PrefixByte.ADDROVR)       //
     {                                      //
         return(3);                         // ADDROVR and SIZEOVR are completely independent of any other prefix
     }                                      //
     else if (input == PrefixByte.SIZEOVR)  //
     {
         return(2);
     }
     else if (input == PrefixByte.REPZ || input == PrefixByte.REPNZ || input == PrefixByte.LOCK) // Only one of REPZ,REPNZ and LOCK can be present at one time
     {
         return(1);
     }
     else // Anything else covers segment override prefixes. E.g if there is a code segment override byte, then after that a data segment override byte, obviously these two wont work together.
     {
         return(0);
     }
 }
Example #2
0
 public static void Clear() => Array.Clear(Prefixes, 0, 4); // Arguably faster than creating a new instance. The old one would have to be destructed at some point.
 public static bool Contains(PrefixByte input) => Prefixes[DetermineIndex(input)] == input;
Example #3
0
 public static void Add(PrefixByte input)
 {
     Prefixes[DetermineIndex(input)] = input; // Take the most recent definition for that prefix index, be it the first or hundreth.
 }