
-----------------------------------
tiedye1
Tue Feb 04, 2014 6:42 pm

Can't find the overflow
-----------------------------------
Hi, I've been working on this algorithm, and It works perfectly for small data sets 
but when I try a larger set the pc (and thus the pp) variable is overflowing, but 
they're longs so I don't know whats causing it.  

Here's the relevant code.


int bp = 0; // Previous bit count
	long pp = 0; // Previous path
	int cnt = 0; // Path count

	// Temp Vars
	long pc = 0; // Current path
	int bc = 0; // Current bit count
	int r = 0;
	int c = 0;
	while(true)
	{
		if (pp != 0)
		{
			while(pp >> (bp-1) != 1) // This loop gets stuck because pp is negative, and the bits that are checked are zero
			{
				--bp;
			}
		}
		if (cnt == 664) 
		{
			cout 