Skip to content

Commit 0ae5853

Browse files
committed
Rename into_vector to into_vec
1 parent f2078d8 commit 0ae5853

File tree

4 files changed

+41
-31
lines changed

4 files changed

+41
-31
lines changed

include/kernel_float/prelude.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,14 @@ static constexpr extent<N> kextent = {};
8282

8383
template<typename... Args>
8484
KERNEL_FLOAT_INLINE kvec<promote_t<Args...>, sizeof...(Args)> make_kvec(Args&&... args) {
85-
return make_vec(std::forward<Args>(args)...);
85+
return ::kernel_float::make_vec(std::forward<Args>(args)...);
8686
};
8787

88+
template<typename V>
89+
KERNEL_FLOAT_INLINE into_vector_type<V> into_kvec(V&& input) {
90+
return ::kernel_float::into_vec(std::forward<V>(input));
91+
}
92+
8893
template<typename T = double>
8994
using kconstant = constant<T>;
9095

include/kernel_float/vector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ struct vector: public S {
279279
* - For vector-like types (e.g., `int2`, `dim3`), it returns `vec<T, N>`.
280280
*/
281281
template<typename V>
282-
KERNEL_FLOAT_INLINE into_vector_type<V> into_vector(V&& input) {
282+
KERNEL_FLOAT_INLINE into_vector_type<V> into_vec(V&& input) {
283283
return into_vector_impl<V>::call(std::forward<V>(input));
284284
}
285285

single_include/kernel_float.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
//================================================================================
1818
// this file has been auto-generated, do not modify its contents!
19-
// date: 2023-09-28 09:58:58.074478
20-
// git hash: 46d598cbca2b9e15abe91848fdcb417d69f0820a
19+
// date: 2023-09-28 11:56:39.597009
20+
// git hash: f2078d86464553ef3c024dde759e5c4ab46fdf6e
2121
//================================================================================
2222

2323
#ifndef KERNEL_FLOAT_MACROS_H
@@ -3099,7 +3099,7 @@ struct vector: public S {
30993099
* - For vector-like types (e.g., `int2`, `dim3`), it returns `vec<T, N>`.
31003100
*/
31013101
template<typename V>
3102-
KERNEL_FLOAT_INLINE into_vector_type<V> into_vector(V&& input) {
3102+
KERNEL_FLOAT_INLINE into_vector_type<V> into_vec(V&& input) {
31033103
return into_vector_impl<V>::call(std::forward<V>(input));
31043104
}
31053105

@@ -3909,9 +3909,14 @@ static constexpr extent<N> kextent = {};
39093909

39103910
template<typename... Args>
39113911
KERNEL_FLOAT_INLINE kvec<promote_t<Args...>, sizeof...(Args)> make_kvec(Args&&... args) {
3912-
return make_vec(std::forward<Args>(args)...);
3912+
return ::kernel_float::make_vec(std::forward<Args>(args)...);
39133913
};
39143914

3915+
template<typename V>
3916+
KERNEL_FLOAT_INLINE into_vector_type<V> into_kvec(V&& input) {
3917+
return ::kernel_float::into_vec(std::forward<V>(input));
3918+
}
3919+
39153920
template<typename T = double>
39163921
using kconstant = constant<T>;
39173922

tests/basics.cu

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -57,39 +57,39 @@ REGISTER_TEST_CASE("basics", basics_tests, int, float)
5757

5858
struct creation_tests {
5959
__host__ __device__ void operator()(generator<int> gen) {
60-
using kernel_float::into_vector;
60+
using kernel_float::into_vec;
6161
using kernel_float::make_vec;
6262

63-
// into_vector on scalar
63+
// into_vec on scalar
6464
{
65-
kf::vec<int, 1> a = into_vector(int(5));
65+
kf::vec<int, 1> a = into_vec(int(5));
6666
ASSERT(a[0] == 5);
6767
}
6868

69-
// into_vector on CUDA vector types
69+
// into_vec on CUDA vector types
7070
{
71-
kf::vec<int, 1> a = into_vector(make_int1(5));
72-
kf::vec<int, 2> b = into_vector(make_int2(5, 4));
73-
kf::vec<int, 3> c = into_vector(make_int3(5, 4, -1));
74-
kf::vec<int, 4> d = into_vector(make_int4(5, 4, -1, 0));
71+
kf::vec<int, 1> a = into_vec(make_int1(5));
72+
kf::vec<int, 2> b = into_vec(make_int2(5, 4));
73+
kf::vec<int, 3> c = into_vec(make_int3(5, 4, -1));
74+
kf::vec<int, 4> d = into_vec(make_int4(5, 4, -1, 0));
7575

7676
ASSERT(a[0] == 5);
7777
ASSERT(b[0] == 5 && b[1] == 4);
7878
ASSERT(c[0] == 5 && c[1] == 4 && c[2] == -1);
7979
ASSERT(d[0] == 5 && d[1] == 4 && d[2] == -1 && d[3] == 0);
8080
}
8181

82-
// into_vector on C-style array
82+
// into_vec on C-style array
8383
{
8484
int items[3] = {1, 2, 3};
85-
kf::vec<int, 3> a = into_vector(items);
85+
kf::vec<int, 3> a = into_vec(items);
8686
ASSERT(a[0] == 1 && a[1] == 2 && a[2] == 3);
8787
}
8888

89-
// into_vector on kf array
89+
// into_vec on kf array
9090
{
9191
kf::vec<int, 3> items = {1, 2, 3};
92-
kf::vec<int, 3> a = into_vector(items);
92+
kf::vec<int, 3> a = into_vec(items);
9393
ASSERT(a[0] == 1 && a[1] == 2 && a[2] == 3);
9494
}
9595

@@ -101,39 +101,39 @@ struct creation_tests {
101101
}
102102

103103
__host__ __device__ void operator()(generator<float> gen) {
104-
using kernel_float::into_vector;
104+
using kernel_float::into_vec;
105105
using kernel_float::make_vec;
106106

107-
// into_vector on scalar
107+
// into_vec on scalar
108108
{
109-
kf::vec<float, 1> a = into_vector(float(5.0f));
109+
kf::vec<float, 1> a = into_vec(float(5.0f));
110110
ASSERT(a[0] == 5.0f);
111111
}
112112

113-
// into_vector on CUDA vector types
113+
// into_vec on CUDA vector types
114114
{
115-
kf::vec<float, 1> a = into_vector(make_float1(5.0f));
116-
kf::vec<float, 2> b = into_vector(make_float2(5.0f, 4.0f));
117-
kf::vec<float, 3> c = into_vector(make_float3(5.0f, 4.0f, -1.0f));
118-
kf::vec<float, 4> d = into_vector(make_float4(5.0f, 4.0f, -1.0f, 0.0f));
115+
kf::vec<float, 1> a = into_vec(make_float1(5.0f));
116+
kf::vec<float, 2> b = into_vec(make_float2(5.0f, 4.0f));
117+
kf::vec<float, 3> c = into_vec(make_float3(5.0f, 4.0f, -1.0f));
118+
kf::vec<float, 4> d = into_vec(make_float4(5.0f, 4.0f, -1.0f, 0.0f));
119119

120120
ASSERT(a[0] == 5.0f);
121121
ASSERT(b[0] == 5.0f && b[1] == 4.0f);
122122
ASSERT(c[0] == 5.0f && c[1] == 4.0f && c[2] == -1.0f);
123123
ASSERT(d[0] == 5.0f && d[1] == 4.0f && d[2] == -1.0f && d[3] == 0.0f);
124124
}
125125

126-
// into_vector on C-style array
126+
// into_vec on C-style array
127127
{
128128
float items[3] = {1.0f, 2.0f, 3.0f};
129-
kf::vec<float, 3> a = into_vector(items);
129+
kf::vec<float, 3> a = into_vec(items);
130130
ASSERT(a[0] == 1.0f && a[1] == 2.0f && a[2] == 3.0f);
131131
}
132132

133-
// into_vector on kf array
133+
// into_vec on kf array
134134
{
135135
kf::vec<float, 3> items = {1.0f, 2.0f, 3.0f};
136-
kf::vec<float, 3> a = into_vector(items);
136+
kf::vec<float, 3> a = into_vec(items);
137137
ASSERT(a[0] == 1.0f && a[1] == 2.0f && a[2] == 3.0f);
138138
}
139139

@@ -145,4 +145,4 @@ struct creation_tests {
145145
}
146146
};
147147

148-
REGISTER_TEST_CASE("into_vec and make_vec", creation_tests, int, float)
148+
REGISTER_TEST_CASE("into_vec and make_vec", creation_tests, int, float)

0 commit comments

Comments
 (0)