mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 01:04:57 +08:00
feature: optimize img2buf and buf2img builtins
Related-To: NEO-16652 Signed-off-by: Narendra Bagria <narendra.bagria@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
4d4da44aff
commit
f460980d14
@@ -119,6 +119,13 @@ inline bool isAligned(T *ptr) {
|
||||
// alignment requirement (returned by alignof) is always a power of 2
|
||||
return (reinterpret_cast<uintptr_t>(ptr) & (alignof(T) - 1)) == 0;
|
||||
}
|
||||
|
||||
// Variadic template to check if all values are aligned
|
||||
template <size_t alignment, typename... Ts>
|
||||
inline constexpr bool isAligned(Ts... vals) {
|
||||
return (isAligned<alignment>(vals) && ...);
|
||||
}
|
||||
|
||||
inline auto allocateAlignedMemory(size_t bytes, size_t alignment) {
|
||||
return std::unique_ptr<void, std::function<decltype(alignedFree)>>(alignedMalloc(bytes, alignment), alignedFree);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user