Challenge: make this Go function inlinable and free of bounds checks

In this post, I challenge you to refactor a small Go function in such a way as to make it inlinable and free of bounds checks, for better performance. Disclaimer : this post assumes version 1.24.2 of the (official) Go compiler ; you may get different results with other versions of the Go compiler or with other implementations of the Go language. Function inlining & bounds-check elimination ¶ Some…