I don't know rust, but what happens if you get a 0xff as the last byte here, wouldn't i+1 go out of array bounds? while i
IIRC, Rust will panic and halt your program. This is one of a handful of errors that Rust can't catch at compile time, and so it inserts run-time checks. The syntax "vec[i+1]" means "I expect this index to be in bounds, and if it's not, my program is so hopelessly broken it should be shut down immediately." If you're really confident in your code and you need to wring out the last bit of performance, you could also u…
> and you need to wring out the last bit of performance,
... and if you've already demonstrated that LLVM hasn't removed the bounds checks itself already.