Hi,
Please have a look at this extremely simplified C++ code which is required for my app. Please keep in mind the real code has a lot more going on.
Here the template pass two i32 as template parameters. This will be later used to read memory chunks with a proper layout.
I avoided a lot of other mechanisms at play like concepts in this example. But the chain of logic is not shallow and it has been done that way for reasons because we need those if constexpr
that expand deeper, and because we like specialisation (opinion, hey, we are humans).
The idea is to have the compiler have the maximum information to create branchless blocks, as much as possible, by giving it as much info at compile time as possible.
Now, in Rust we have const generics, but I fear my example still relies on specialisation
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=756181c9f6317ec307723bacb728ea8f, hence the error.
What would be the cleanest way to do it in Rust, currently. We can use nightly, no issue but if we have to wait we will.
Please don't give me the final code, just keywords instead. It will point me in the right direction and I will try by myself.
Thanks