comparison data/model/PowerOfSqrtTwoZoomConstraint.cpp @ 608:d7f3dfe6f9a4

* solaris build fixes
author Chris Cannam
date Thu, 10 Sep 2009 18:44:45 +0000
parents 166c22eff678
children 06f13a3b9e9e
comparison
equal deleted inserted replaced
607:a67651386253 608:d7f3dfe6f9a4
42 type = -1; 42 type = -1;
43 power = 0; 43 power = 0;
44 float val = 1.0, prevVal = 1.0; 44 float val = 1.0, prevVal = 1.0;
45 while (val + 0.01 < blockSize) { 45 while (val + 0.01 < blockSize) {
46 prevVal = val; 46 prevVal = val;
47 val *= sqrt(2); 47 val *= sqrt(2.f);
48 } 48 }
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);
68 68
69 unsigned int base; 69 unsigned int base;
70 if (type == 0) { 70 if (type == 0) {
71 base = (1 << power); 71 base = (1 << power);
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 // std::cerr << "Testing base " << base << std::endl;
78 78