| 280 | |
| 281 | template <typename GridVisitor> |
| 282 | inline void traverseGridSegment(const vec2f &start, const vec2f &end, |
| 283 | GridVisitor &visitor) { |
| 284 | float dx = fl::abs(end.x - start.x); |
| 285 | float dy = fl::abs(end.y - start.y); |
| 286 | float maxRange = fl::max(dx, dy); |
| 287 | |
| 288 | // if (maxRange < 256.0f) { |
| 289 | // // Use Q8.8 (16-bit signed) if within ±127 |
| 290 | // traverseGridSegment16(start, end, visitor); |
| 291 | // } |
| 292 | // else if (maxRange < 16777216.0f) { |
| 293 | // // Use Q24.8 (32-bit signed) if within ±8 million |
| 294 | // traverseGridSegment32(start, end, visitor); |
| 295 | // } |
| 296 | // else { |
| 297 | // // Fall back to floating-point |
| 298 | // traverseGridSegment(start, end, visitor); |
| 299 | // } |
| 300 | |
| 301 | if (maxRange < 256.0f) { |
| 302 | // Use Q8.8 (16-bit signed) if within ±127 |
| 303 | traverseGridSegment16(start, end, visitor); |
| 304 | } else { |
| 305 | // Use Q24.8 (32-bit signed) if within ±8 million |
| 306 | traverseGridSegment32(start, end, visitor); |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | } // namespace fl |
no test coverage detected