[PATCH] D75459: [mlir] Add padding to 1-D Vector in CRunnerUtils.h

Frank Laub via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 16:40:12 PST 2020


flaub added inline comments.


================
Comment at: mlir/include/mlir/ExecutionEngine/CRunnerUtils.h:42
 //===----------------------------------------------------------------------===//
+namespace detail {
+  template <unsigned N>
----------------
We should be able to replace this chunk with:

```
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);
}
```

This should work on C++11 and also works with MSVC.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75459/new/

https://reviews.llvm.org/D75459





More information about the llvm-commits mailing list