iMackshun

Test

Jan 19th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. //Array of functions.
  2. Function func[functionArraySize];
  3. //Array of instructions to filter by. That is a function must contain all of these instructions to be added to the filtered vector.
  4. Instruction instructionSet[instructionSetSize];
  5. //Filtered functions.
  6. std::vector<Function> filteredFunctions;
  7.  
  8. for(unsigned int i = 0; i < functionArraySize; i++){
  9.     bool hasAllInstructions = true;
  10.     for(unsigned int j = 0; j < instructionSetSize; j++){
  11.         bool instructionFound = false;
  12.         //Loop through the instructions of the function and look for a match.
  13.         for(unsigned int k = 0; k < func[i].instructionCount; k++){
  14.             if(func[i].instructions[k] == instructionSet[j]){
  15.                 instructionFound = true;
  16.             }
  17.         }
  18.         hasAllInstructions &= instructionFound;
  19.     }
  20.     //If all of the instructions were found, add to the vector.
  21.     if(hasAllInstructions){
  22.         filteredFunctions.push_back(func[i]);
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment