Function
offset_index
(current: usize, len: usize, delta: isize)
Source from the content-addressed store, hash-verified
| 1247 | .unwrap_or(false); |
| 1248 | if changed { |
| 1249 | refresh_all(ctx); |
| 1250 | } |
| 1251 | } |
| 1252 | |
| 1253 | pub fn offset_index(current: usize, len: usize, delta: isize) -> usize { |
| 1254 | if len == 0 { |
| 1255 | return 0; |
| 1256 | } |
| 1257 | if delta < 0 { |
| 1258 | current.saturating_sub(delta.unsigned_abs()) |
| 1259 | } else { |
| 1260 | (current + delta as usize).min(len - 1) |
| 1261 | } |
Callers
nothing calls this directly
Tested by
no test coverage detected