Project Alice
Loading...
Searching...
No Matches
ve_scalar_extensions.hpp
Go to the documentation of this file.
1#pragma once
2
3namespace ve {
4
5template<typename T>
6inline T select(bool v, T a, T b) {
7 return v ? a : b;
8}
9
10inline float to_float(int32_t a) {
11 return float(a);
12}
13inline float to_float(uint32_t a) {
14 return float(a);
15}
16inline float to_float(uint16_t a) {
17 return float(a);
18}
19inline float to_float(int16_t a) {
20 return float(a);
21}
22inline float to_float(uint8_t a) {
23 return float(a);
24}
25inline float to_float(int8_t a) {
26 return float(a);
27}
28
29inline int32_t to_int(int32_t a) {
30 return int32_t(a);
31}
32inline int32_t to_int(uint32_t a) {
33 return int32_t(a);
34}
35inline int32_t to_int(uint16_t a) {
36 return int32_t(a);
37}
38inline int32_t to_int(int16_t a) {
39 return int32_t(a);
40}
41inline int32_t to_int(uint8_t a) {
42 return int32_t(a);
43}
44inline int32_t to_int(int8_t a) {
45 return int32_t(a);
46}
47inline int32_t to_int(float a) {
48 return int32_t(a);
49}
50
51inline bool compress_mask(bool v) {
52 return v;
53}
54
55template<typename tag_type>
56mask_vector operator==(contiguous_tags_base<tag_type> a, tag_type b) {
57 return a == tagged_vector<tag_type>(b);
58}
59template<typename tag_type>
60mask_vector operator!=(contiguous_tags_base<tag_type> a, tag_type b) {
61 return a != tagged_vector<tag_type>(b);
62}
63
64template<typename tag_type>
65mask_vector operator==(tag_type b, contiguous_tags_base<tag_type> a) {
66 return a == tagged_vector<tag_type>(b);
67}
68template<typename tag_type>
69mask_vector operator!=(tag_type b, contiguous_tags_base<tag_type> a) {
70 return a != tagged_vector<tag_type>(b);
71}
72
73} // namespace ve
T select(bool v, T a, T b)
mask_vector operator==(contiguous_tags_base< tag_type > a, tag_type b)
mask_vector operator!=(contiguous_tags_base< tag_type > a, tag_type b)
int32_t to_int(int32_t a)
bool compress_mask(bool v)
float to_float(int32_t a)
uint uint32_t
uchar uint8_t