[llvm] [libsycl] USM Aligned allocation functions (PR #213468)
Sergey Semenov via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 17 06:06:32 PDT 2026
================
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This file contains the declaration of functions commonly used in SYCL
+/// runtime implementation.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBSYCL___IMPL_DETAIL_COMMON_HPP
+#define _LIBSYCL___IMPL_DETAIL_COMMON_HPP
+
+#include <sycl/__impl/detail/config.hpp>
+
+_LIBSYCL_BEGIN_NAMESPACE_SYCL
+
+namespace detail {
+
+constexpr bool isPowerOf2(std::size_t n) { return (n & (n - 1)) == 0; }
----------------
sergey-semenov wrote:
This would return true for 0, which is not a power of 2.
https://github.com/llvm/llvm-project/pull/213468
More information about the llvm-commits
mailing list