diff gen/README @ 45:7955bed1d169 default tip

*: add preliminary floating point support no x86 intrinsics just yet, but I did add altivec since it's (arguably) the simplest :)
author Paper <paper@tflc.us>
date Wed, 30 Apr 2025 18:36:38 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gen/README	Wed Apr 30 18:36:38 2025 -0400
@@ -0,0 +1,23 @@
+These files are used to generate the actual implementation headers in
+`include/vec/impl`.
+
+All of them are basically compiled the same way:
+	gcc -o genIMPL genIMPL.c genlib.c
+
+You can generally base any new implementations off of one of the existing
+ones. Preferably, you would base it off the generic implementation, since
+it actually has all of the operations implemented (and serves as a
+reference as to how these operations *should* work). For example the avg
+operation on integers should be roughly equivalent to:
+	ceil((vec1 + vec2) / 2)
+
+Note how it always rounds up, rather than truncating towards zero. This
+is an important implementation detail, and stems from roots in AltiVec,
+as it was the inspiration behind much of the vec API.
+
+Note however, that avg has a different result with floating points that
+is equivalent to simply
+	((vec1 + vec2) / 2)
+as there is no real way to get around any possible truncation.
+
+Any overflow on integer operations should simply wrap around.