expressions: add much faster limitToSignatures()

This commit is contained in:
Justin Viiret
2017-04-07 17:02:00 +10:00
committed by Matthew Barr
parent 0b8f25a036
commit 083d84cfd6
3 changed files with 22 additions and 26 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Intel Corporation
* Copyright (c) 2015-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -31,10 +31,10 @@
#include <map>
#include <string>
#include <list>
#include <vector>
typedef std::map<unsigned, std::string> ExpressionMap;
typedef std::list<unsigned> SignatureSet;
using ExpressionMap = std::map<unsigned, std::string>;
using SignatureSet = std::vector<unsigned>;
// load all of the expressions from the given directory into the given
// expression map. Exits on failure.
@@ -45,11 +45,8 @@ void loadExpressionsFromFile(const std::string &fname, ExpressionMap &exprMap);
// load a list of signature IDs
void loadSignatureList(const std::string &inFile, SignatureSet &signatures);
// produce a new expression map only containing those signatures in the
// expression list
void generateExprMap(const SignatureSet &signatures,
const ExpressionMap &allExprs, ExpressionMap &out);
// trim expression map to only the given signatures, returning result
ExpressionMap limitToSignatures(const ExpressionMap &exprMap,
const SignatureSet &signatures);
// trim expression map to only the given signatures (in-place)
void limitBySignature(ExpressionMap &exprMap, const SignatureSet &signatures);
#endif