diff options
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/ezsat/ezminisat.h | 2 | ||||
| -rw-r--r-- | libs/subcircuit/README | 6 | ||||
| -rw-r--r-- | libs/subcircuit/subcircuit.cc | 10 | 
3 files changed, 8 insertions, 10 deletions
| diff --git a/libs/ezsat/ezminisat.h b/libs/ezsat/ezminisat.h index 983e6fd0e..3a34c13c8 100644 --- a/libs/ezsat/ezminisat.h +++ b/libs/ezsat/ezminisat.h @@ -28,7 +28,7 @@  #include <time.h>  // minisat is using limit macros and format macros in their headers that -// can be the source of some troubles when used from c++11. thefore we +// can be the source of some troubles when used from c++11. therefore we  // don't force ezSAT users to use minisat headers..  namespace Minisat {  	class Solver; diff --git a/libs/subcircuit/README b/libs/subcircuit/README index b1335681e..ecaa987db 100644 --- a/libs/subcircuit/README +++ b/libs/subcircuit/README @@ -109,7 +109,7 @@ look at the demo.cc example program in this directory.  Setting up graphs  ----------------- -Instanciate the SubCircuit::Graph class and use the methods of this class to +Instantiate the SubCircuit::Graph class and use the methods of this class to  set up the circuit.  	SubCircuit::Graph myGraph; @@ -152,7 +152,7 @@ rotate shift,  The method createConstant() can be used to add a constant driver to a signal.  The signal value is encoded as one char by bit, allowing for multi-valued -logic matching. The follwoing command sets the lowest bit of cell6.A to a +logic matching. The following command sets the lowest bit of cell6.A to a  logic 1:  	myGraph.createConnection("cell6", "A", 0, '1'); @@ -314,7 +314,7 @@ bool userCompareEdge(needleGraphId, needleFromNodeId, needleFromUserData, needle  	Perform additional checks on a pair of a pair of adjacent nodes (one  	adjacent pair from the needle and one adjacent pair from the haystack) -	to determine wheter this edge from the needle is compatible with +	to determine whether this edge from the needle is compatible with  	that edge from the haystack. The default implementation always  	returns true. diff --git a/libs/subcircuit/subcircuit.cc b/libs/subcircuit/subcircuit.cc index 7c7236833..e8361a67e 100644 --- a/libs/subcircuit/subcircuit.cc +++ b/libs/subcircuit/subcircuit.cc @@ -320,12 +320,10 @@ class SubCircuit::SolverWorker  	static int numberOfPermutations(const std::vector<std::string> &list)  	{ -		int numPermutations = 1; -		for (int i = 0; i < int(list.size()); i++) { -			assert(numPermutations < maxPermutationsLimit); -			numPermutations *= i+1; -		} -		return numPermutations; +		constexpr size_t mappedPermutationsSize = 10; +		constexpr int mappedPermutations[mappedPermutationsSize] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880}; +		assert(list.size() < mappedPermutationsSize); +		return mappedPermutations[list.size()];  	}  	static void permutateVectorToMap(std::map<std::string, std::string> &map, const std::vector<std::string> &list, int idx) | 
