forked from halide/Halide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathType.cpp
More file actions
71 lines (55 loc) · 1.17 KB
/
Type.cpp
File metadata and controls
71 lines (55 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "Type.h"
namespace Halide {
ML_FUNC1(makeFloatType);
ML_FUNC1(makeIntType);
ML_FUNC1(makeUIntType);
template<>
Type TypeOf<float>() {
return Float(32);
}
template<>
Type TypeOf<double>() {
return Float(64);
}
template<>
Type TypeOf<unsigned char>() {
return UInt(8);
}
template<>
Type TypeOf<unsigned short>() {
return UInt(16);
}
template<>
Type TypeOf<unsigned int>() {
return UInt(32);
}
template<>
Type TypeOf<bool>() {
return Int(1);
}
template<>
Type TypeOf<char>() {
return Int(8);
}
template<>
Type TypeOf<short>() {
return Int(16);
}
template<>
Type TypeOf<int>() {
return Int(32);
}
template<>
Type TypeOf<signed char>() {
return Int(8);
}
Type Float(unsigned char bits) {
return Type {makeFloatType((bits)), bits, Type::FLOAT};
}
Type Int(unsigned char bits) {
return Type {makeIntType((bits)), bits, Type::INT};
}
Type UInt(unsigned char bits) {
return Type {makeUIntType((bits)), bits, Type::UINT};
}
}