I guess the bounds checking part of `safe_get` would be replaced by `if !have_enough_space(p, end, w) { /* use REPLACEMENT */ }` called once, before the `match` so the other indexes can be unchecked.