| 66 | } |
| 67 | |
| 68 | inline Encoded encodeCoordinate(Float64 coord, Float64 min, Float64 max, uint8_t bits) |
| 69 | { |
| 70 | Encoded result; |
| 71 | result.fill(0); |
| 72 | |
| 73 | for (size_t i = 0; i < bits; ++i) |
| 74 | { |
| 75 | const Float64 mid = (max + min) / 2; |
| 76 | if (coord >= mid) |
| 77 | { |
| 78 | result[i] = 1; |
| 79 | min = mid; |
| 80 | } |
| 81 | else |
| 82 | { |
| 83 | result[i] = 0; |
| 84 | max = mid; |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | return result; |
| 89 | } |
| 90 | |
| 91 | inline Float64 decodeCoordinate(const Encoded & coord, Float64 min, Float64 max, uint8_t bits) |
| 92 | { |
no test coverage detected