the_Foundation [main]

Math: SSE variant of xy_F3

=> 251b1dd8a9677b5a08b44a1037485c8e1a57252e

diff --git a/include/the_Foundation/math_sse.h b/include/the_Foundation/math_sse.h
index 8980aff..84427fa 100644
--- a/include/the_Foundation/math_sse.h
+++ b/include/the_Foundation/math_sse.h
@@ -266,6 +266,11 @@ iLocalDef iFloatVec3 values_F3(const iFloat3 d) {
 
 #define iFloat3Shuffle3(d, X, Y, Z)  (iFloat3){ _mm_shuffle_ps((d).m, (d).m, _MM_SHUFFLE(Z, Y, X, 0)) }
 
+iLocalDef iFloat3 xy_F3(const iFloat3 d) {
+    __m128 t = _mm_move_ss(d.m, _mm_set_ss(0));
+    return (iFloat3){ _mm_shuffle_ps(t, t, _MM_SHUFFLE(0, 2, 1, 0)) };
+}
+
 iLocalDef iFloat3 yzx_F3(const iFloat3 d) {
     return iFloat3Shuffle3(d, 2, 3, 1);
 }
diff --git a/tests/t_math.c b/tests/t_math.c
index fd44355..ad001bf 100644
--- a/tests/t_math.c
+++ b/tests/t_math.c
@@ -125,7 +125,7 @@ int main(int argc, char **argv) {
                 iMaxf(3.f, 5.f),
                 iClampf(1, 3, 5), iClampf(7, 3, 5), iClampf(4, 3, 5));
     }
-    /* Basic vectoring. */ {
+    /* Basic vectors. */ {
         print_("zero", zero_F4());
         print_("init4", init_F4(1, 2, 3, 4)); {
             float f[4];
@@ -147,7 +147,8 @@ int main(int argc, char **argv) {
                length_F3(init_F3(0, -2, 0)),
                length_F3(init_F3(0, 0, -2)));
         printf("Sum: F3: %f F4: %f\n", sum_F3(init_F3(1, 2, 3)), sum_F4(init_F4(1, 2, 3, 4)));
-        print_("init3", init_F3(2, 3, 4)); {
+        print_("init3", init_F3(2, 3, 4));
+        print_("xy_F3", xy_F3(init_F3(2, 3, 4))); {
             iFloat3 v3 = init_F3(1, 1, 1);
             setX_F3(&v3, 2);
             print_("set x", v3);
Proxy Information
Original URL
gemini://git.skyjake.fi/the_Foundation/main/cdiff/251b1dd8a9677b5a08b44a1037485c8e1a57252e
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
27.854169 milliseconds
Gemini-to-HTML Time
0.178137 milliseconds

This content has been proxied by September (ba2dc).