Smallest multiple of `interval` that is >= value (handles negatives exactly, no double precision loss at epoch scale).
| 72 | // Smallest multiple of `interval` that is >= value (handles negatives exactly, |
| 73 | // no double precision loss at epoch scale). |
| 74 | qint64 ceilToMultiple(qint64 value, qint64 interval) noexcept { |
| 75 | const qint64 q = value / interval; // truncates toward zero |
| 76 | const qint64 floored = q * interval; |
| 77 | if (floored == value) { |
| 78 | return value; |
| 79 | } |
| 80 | return (value > 0) ? floored + interval : floored; |
| 81 | } |
| 82 | } // namespace |
| 83 | |
| 84 | void TimelineScene::setTracks(std::vector<TimelineSpanInput> tracks) { |