//===----------------------------------------------------------------------===// // // Part of the DirectXShaderCompiler, 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 // //===----------------------------------------------------------------------===// // Header for vector template utility functions for operating on vector // templates. //===----------------------------------------------------------------------===// #ifndef __HLSL_VECTOR_UTILS #define __HLSL_VECTOR_UTILS #if __HLSL_VERSION >= 2021 #include namespace hlsl { template typename hlsl::enable_if >::type slice(vector In) { vector Result = (vector)0; [unroll] for (int I = 0; I < OSz; ++I) Result[I] = In[I + Off]; return Result; } template vector slice(vector In) { return slice<0, OSz, T, ISz>(In); } } // namespace hlsl #endif // __HLSL_VERSION >= 2021 #endif // __HLSL_VECTOR_UTILS