Mercurial > vec
comparison 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 |
comparison
equal
deleted
inserted
replaced
44:b0a3f0248ecc | 45:7955bed1d169 |
---|---|
1 These files are used to generate the actual implementation headers in | |
2 `include/vec/impl`. | |
3 | |
4 All of them are basically compiled the same way: | |
5 gcc -o genIMPL genIMPL.c genlib.c | |
6 | |
7 You can generally base any new implementations off of one of the existing | |
8 ones. Preferably, you would base it off the generic implementation, since | |
9 it actually has all of the operations implemented (and serves as a | |
10 reference as to how these operations *should* work). For example the avg | |
11 operation on integers should be roughly equivalent to: | |
12 ceil((vec1 + vec2) / 2) | |
13 | |
14 Note how it always rounds up, rather than truncating towards zero. This | |
15 is an important implementation detail, and stems from roots in AltiVec, | |
16 as it was the inspiration behind much of the vec API. | |
17 | |
18 Note however, that avg has a different result with floating points that | |
19 is equivalent to simply | |
20 ((vec1 + vec2) / 2) | |
21 as there is no real way to get around any possible truncation. | |
22 | |
23 Any overflow on integer operations should simply wrap around. |