[PATCH] D76031: [mlir][CRunnerUtils] Enable compilation with C++11 toolchain on microcontroller platforms.
Nicolas Vasilache via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 11 15:20:09 PDT 2020
nicolasvasilache updated this revision to Diff 249772.
nicolasvasilache added a comment.
Update commit message.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76031/new/
https://reviews.llvm.org/D76031
Files:
mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
Index: mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
===================================================================
--- mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
+++ mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
@@ -45,9 +45,7 @@
constexpr bool isPowerOf2(int N) { return (!(N & (N - 1))); }
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));
}
template <typename T, int Dim, bool IsPowerOf2>
@@ -59,8 +57,8 @@
static_assert(detail::nextPowerOf2(sizeof(T[Dim])) == sizeof(T[Dim]),
"size error");
}
- constexpr T &operator[](unsigned i) { return vector[i]; }
- constexpr const T &operator[](unsigned i) const { return vector[i]; }
+ inline T &operator[](unsigned i) { return vector[i]; }
+ inline const T &operator[](unsigned i) const { return vector[i]; }
private:
T vector[Dim];
@@ -76,8 +74,8 @@
static_assert(detail::nextPowerOf2(sizeof(T[Dim])) < 2 * sizeof(T[Dim]),
"size error");
}
- constexpr T &operator[](unsigned i) { return vector[i]; }
- constexpr const T &operator[](unsigned i) const { return vector[i]; }
+ inline T &operator[](unsigned i) { return vector[i]; }
+ inline const T &operator[](unsigned i) const { return vector[i]; }
private:
T vector[Dim];
@@ -88,8 +86,8 @@
// N-D vectors recurse down to 1-D.
template <typename T, int Dim, int... Dims>
struct Vector {
- constexpr Vector<T, Dims...> &operator[](unsigned i) { return vector[i]; }
- constexpr const Vector<T, Dims...> &operator[](unsigned i) const {
+ inline Vector<T, Dims...> &operator[](unsigned i) { return vector[i]; }
+ inline const Vector<T, Dims...> &operator[](unsigned i) const {
return vector[i];
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76031.249772.patch
Type: text/x-patch
Size: 1866 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200311/0272a79b/attachment-0001.bin>
More information about the llvm-commits
mailing list