[PATCH] D76031: [mlir][CRunnerUtils] Enable compilation with C++11 toolchain on microcontroller platforms.
Frank Laub via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 11 16:06:35 PDT 2020
flaub added a comment.
I don't have MSVC at this minute but this seems OK. Is it that the older compiler doesn't understand `constexpr` functions? I guess there's no fundamental reason the accessor operators need to be `constexpr`.
================
Comment at: mlir/include/mlir/ExecutionEngine/CRunnerUtils.h:48
constexpr unsigned nextPowerOf2(int N) {
- if (N <= 1)
- return 1;
- return isPowerOf2(N) ? N : 2 * nextPowerOf2((N + 1) / 2);
+ return (N <= 1) ? 1 : (isPowerOf2(N) ? N : 2 * nextPowerOf2((N + 1) / 2));
}
----------------
aartbik wrote:
> perhaps use () on the part after : too for readability
> (assuming this does not violate some llvm brevity rule I don't know yet :-)
Chaining multiple ternary operations just seems less readable than the original.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76031/new/
https://reviews.llvm.org/D76031
More information about the llvm-commits
mailing list