Fixed Gray calculation in KV_PiEleLoc
This commit is contained in:
		
							parent
							
								
									ed1b206cff
								
							
						
					
					
						commit
						ac7e6ff233
					
				
					 2 changed files with 5 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include "stdafx.h"
 | 
			
		||||
#include "Tools.h"
 | 
			
		||||
 | 
			
		||||
using namespace std;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -20,9 +21,9 @@ public:
 | 
			
		|||
		this->i = i;
 | 
			
		||||
 | 
			
		||||
		this->w = i & ((0x1 << (numVarX)) - 1);		// get x coord
 | 
			
		||||
		this->w ^= w/2;								// make it gray
 | 
			
		||||
		this->w = Tools::GrayToBinary(w);
 | 
			
		||||
 | 
			
		||||
		this->h = i >> numVarX;						// get y coord
 | 
			
		||||
		this->h ^= h/2;								// make it gray
 | 
			
		||||
		this->h = Tools::GrayToBinary(h);
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,7 @@
 | 
			
		|||
#include <string>
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include "Tools.h"
 | 
			
		||||
#include "PrimImplikant.h"
 | 
			
		||||
 | 
			
		||||
using namespace std;
 | 
			
		||||
| 
						 | 
				
			
			@ -53,11 +54,7 @@ void PrimImplikant::sort()
 | 
			
		|||
 | 
			
		||||
bool PrimImplikant::compareGray(uint a, uint b)
 | 
			
		||||
{
 | 
			
		||||
	for (uint i = 1; i < dimension; i++)
 | 
			
		||||
		a ^= a / 2;		// convert a from gray to binary
 | 
			
		||||
	for (uint i = 1; i < dimension; i++)
 | 
			
		||||
		b ^= b / 2;		// convert b from gray to binary
 | 
			
		||||
	return a < b;
 | 
			
		||||
	return Tools::GrayToBinary(a) < Tools::GrayToBinary(b);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PrimImplikant::makeLocations()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue