Skip to content

Commit b10271f

Browse files
committed
update float2 example
1 parent 03e5e91 commit b10271f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: float_2/test_float2.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
#include <hc.hpp>
22
#include <hc_short_vector.hpp>
33

4-
int main() {
4+
int main(int argc, char* argv[]) {
55

66
hc::array_view<hc::short_vector::float2,1> data(64);
7+
hc::short_vector::float2 hf2 = { 1000.0f, 2000.0f };
8+
9+
if (argc >=3) {
10+
hf2.x = atof(argv[1]);
11+
hf2.y = atof(argv[2]);
12+
}
13+
714
hc::parallel_for_each(data.get_extent(), [=](hc::index<1> i) [[hc]] {
815
hc::short_vector::float2 v = { (float)i[0], 100.0f + i[0] };
16+
v+=hf2;
917
data[i] = v;
1018
});
1119

0 commit comments

Comments
 (0)