comparison data/model/PowerOfSqrtTwoZoomConstraint.cpp @ 689:573d45e9487b

Merge from debug-output branch
author Chris Cannam
date Tue, 14 Jun 2011 14:47:59 +0100
parents 06f13a3b9e9e
children 1424aa29ae95
comparison
equal deleted inserted replaced
688:be43b2fe68e8 689:573d45e9487b
49 size_t rval; 49 size_t rval;
50 if (dir == RoundUp) rval = size_t(val + 0.01); 50 if (dir == RoundUp) rval = size_t(val + 0.01);
51 else if (dir == RoundDown) rval = size_t(prevVal + 0.01); 51 else if (dir == RoundDown) rval = size_t(prevVal + 0.01);
52 else if (val - blockSize < blockSize - prevVal) rval = size_t(val + 0.01); 52 else if (val - blockSize < blockSize - prevVal) rval = size_t(val + 0.01);
53 else rval = size_t(prevVal + 0.01); 53 else rval = size_t(prevVal + 0.01);
54 // std::cerr << "returning " << rval << std::endl; 54 // DEBUG << "returning " << rval << endl;
55 return rval; 55 return rval;
56 } 56 }
57 57
58 unsigned int prevBase = (1 << minCachePower); 58 unsigned int prevBase = (1 << minCachePower);
59 unsigned int prevPower = minCachePower; 59 unsigned int prevPower = minCachePower;
72 } else { 72 } else {
73 base = (((unsigned int)((1 << minCachePower) * sqrt(2.) + 0.01)) 73 base = (((unsigned int)((1 << minCachePower) * sqrt(2.) + 0.01))
74 << (power - minCachePower)); 74 << (power - minCachePower));
75 } 75 }
76 76
77 // std::cerr << "Testing base " << base << std::endl; 77 // DEBUG << "Testing base " << base << endl;
78 78
79 if (base == blockSize) { 79 if (base == blockSize) {
80 result = base; 80 result = base;
81 break; 81 break;
82 } 82 }