* Quadrant III (step > 0). */
| 1557 | * Quadrant III (step > 0). |
| 1558 | */ |
| 1559 | staticfn int |
| 1560 | _q3_path(int scol, int srow, int y2, int x2) |
| 1561 | { |
| 1562 | int dx, dy; |
| 1563 | int k, err, x, y, dxs, dys; |
| 1564 | |
| 1565 | x = scol; |
| 1566 | y = srow; |
| 1567 | dx = x - x2; |
| 1568 | dy = y2 - y; |
| 1569 | |
| 1570 | dxs = dx << 1; /* save the shifted values */ |
| 1571 | dys = dy << 1; |
| 1572 | if (dy > dx) { |
| 1573 | err = dxs - dy; |
| 1574 | |
| 1575 | for (k = dy - 1; k; k--) { |
| 1576 | if (err >= 0) { |
| 1577 | x--; |
| 1578 | err -= dys; |
| 1579 | } |
| 1580 | y++; |
| 1581 | err += dxs; |
| 1582 | if (!is_clear(y, x)) |
| 1583 | return 0; /* blocked */ |
| 1584 | } |
| 1585 | } else { |
| 1586 | err = dys - dx; |
| 1587 | |
| 1588 | for (k = dx - 1; k; k--) { |
| 1589 | if (err >= 0) { |
| 1590 | y++; |
| 1591 | err -= dxs; |
| 1592 | } |
| 1593 | x--; |
| 1594 | err += dys; |
| 1595 | if (!is_clear(y, x)) |
| 1596 | return 0; /* blocked */ |
| 1597 | } |
| 1598 | } |
| 1599 | |
| 1600 | return 1; |
| 1601 | } |
| 1602 | |
| 1603 | #endif /* ?MACRO_CPATH */ |
| 1604 |
nothing calls this directly
no outgoing calls
no test coverage detected