clang
22.0.0git
lib
Headers
hlsl
hlsl_detail.h
Go to the documentation of this file.
1
//===----- hlsl_detail.h - HLSL definitions for intrinsics ----------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#ifndef _HLSL_HLSL_DETAILS_H_
10
#define _HLSL_HLSL_DETAILS_H_
11
12
namespace
hlsl
{
13
14
namespace
__detail
{
15
16
template
<
typename
T,
typename
U>
struct
is_same
{
17
static
const
bool
value
=
false
;
18
};
19
20
template
<
typename
T>
struct
is_same
<T, T> {
21
static
const
bool
value
=
true
;
22
};
23
24
template
<
bool
B,
typename
T>
struct
enable_if
{};
25
26
template
<
typename
T>
struct
enable_if
<
true
, T> {
27
using
Type
= T;
28
};
29
30
template
<
bool
B,
class
T =
void
>
31
using
enable_if_t
=
typename
enable_if<B, T>::Type
;
32
33
template
<
typename
U,
typename
T,
int
N>
34
constexpr
enable_if_t
<
sizeof
(
U
) ==
sizeof
(T), vector<U, N>>
35
bit_cast
(vector<T, N>
V
) {
36
return
__builtin_bit_cast(vector<U, N>,
V
);
37
}
38
39
template
<
typename
U,
typename
T>
40
constexpr
enable_if_t
<
sizeof
(
U
) ==
sizeof
(T),
U
>
bit_cast
(T F) {
41
return
__builtin_bit_cast(
U
, F);
42
}
43
44
template
<
typename
T>
struct
is_arithmetic
{
45
static
const
bool
Value
= __is_arithmetic(T);
46
};
47
48
template
<
typename
T,
int
N>
49
using
HLSL_FIXED_VECTOR
=
50
vector<
__detail::enable_if_t
<(N > 1 && N <= 4), T>, N>;
51
52
}
// namespace __detail
53
}
// namespace hlsl
54
#endif
//_HLSL_HLSL_DETAILS_H_
V
#define V(N, I)
Definition
ASTContext.h:3584
U
hlsl::__detail
Definition
hlsl_detail.h:14
hlsl::__detail::enable_if_t
typename enable_if< B, T >::Type enable_if_t
Definition
hlsl_detail.h:31
hlsl::__detail::HLSL_FIXED_VECTOR
vector< __detail::enable_if_t<(N > 1 &&N<=4), T >, N > HLSL_FIXED_VECTOR
Definition
hlsl_detail.h:49
hlsl::__detail::bit_cast
constexpr enable_if_t< sizeof(U)==sizeof(T), vector< U, N > > bit_cast(vector< T, N > V)
Definition
hlsl_detail.h:35
hlsl
Definition
hlsl_alias_intrinsics.h:12
true
#define true
Definition
stdbool.h:25
hlsl::__detail::enable_if< true, T >::Type
T Type
Definition
hlsl_detail.h:27
hlsl::__detail::enable_if
Definition
hlsl_detail.h:24
hlsl::__detail::is_arithmetic
Definition
hlsl_detail.h:44
hlsl::__detail::is_arithmetic::Value
static const bool Value
Definition
hlsl_detail.h:45
hlsl::__detail::is_same< T, T >::value
static const bool value
Definition
hlsl_detail.h:21
hlsl::__detail::is_same
Definition
hlsl_detail.h:16
hlsl::__detail::is_same::value
static const bool value
Definition
hlsl_detail.h:17
Generated on
for clang by
1.14.0