Mercurial > vec
view gen/README @ 46:31cee67540b5
f32/f64: add floor, ceil, round, and trunc operations
we also need saturated add sub mul etc
author | Paper <paper@tflc.us> |
---|---|
date | Sat, 09 Aug 2025 15:55:59 -0400 |
parents | 7955bed1d169 |
children |
line wrap: on
line source
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.