Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There's a per-packet bounds check here [1] which probably can't be eliminated by the compiler because it cycles over the array. I imagine that's noticeable.

[1]: https://github.com/ixy-languages/ixy.rs/blob/master/src/ixgb...



So the bounds check is:

    queue.bufs_in_use[rx_index]
If so the bounds check could possibly be safely eliminated by the programmer because I think `wrap_ring` ensures that rx_index will always be in bounds?


Yes. It wouldn't be too unidiomatic to use get_unchecked in those two places, perhaps with a debug_assert! in place.

It would be really nice if this wasn't needed, but it's a valid use of unsafe code.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: