2 ms·
It's unfortunate that the enum-based solution doesn't work, but that particular example can be made "optimal" (at least, as good control flow as LLVM can get th
by dbaupp 8y ago
It's unfortunate that the enum-based solution doesn't work, but that particular example can be made "optimal" (at least, as good control flow as LLVM can get this code: the same as clang, not GCC), by using a rather unpleasant series of loops and labelled breaks: https://godbolt.org/z/sQ1nH8 https://godbolt.org/z/sQ1nH8 (rustfmt'd version: https://play.rust-lang.org/?gist=b1091e0c583b88f27bf1eaeae3a670f0&version=stable&mode=debug&edition=2015 https://play.rust-lang.org/?gist=b1091e0c583b88f27bf1eaeae3a...).
This doesn't work in general, and is ... impossible to maintain, but it's not an unreasonable approach for generated code.