
19 Jan
2009
19 Jan
'09
8:47 a.m.
Mathias Gaunard a écrit :
How are you supposed to code in a portable way?
If I write vec<float> = {5., 5., 5., 5.};
the code will only compile if the SIMD register is 4 floats big on that architecture (as you said yourself).
If it was vec<float, 4> = {5., 5., 5., 5.}; the library could actually fallback to something else to make the code work...
Fact is that there is no SIMD extension with less than 4 float per register and all upcoming ones go with more than that. In this case, if your float vector ends up having 8 element, it will jus follow the rule of the {} consructor and fill the rest with 0. I can see the problem however and maybe this notation should be removed in favor of a make_vector function.