Mercurial > vec
view README @ 1:1d9d2308c1d2
*: fixup formatting
ew
author | Paper <paper@tflc.us> |
---|---|
date | Tue, 22 Oct 2024 01:28:48 -0400 |
parents | 02a517e4c492 |
children | f12b5dd4e18c |
line wrap: on
line source
vec - a tiny SIMD vector header-only library written in C99 it comes with an extremely basic (and somewhat lacking) API, where there are eight supported vector types, all 128-bit: vint8x16 - 16 signed 8-bit integers vint16x8 - 8 signed 16-bit integers vint32x4 - 4 signed 32-bit integers vint64x2 - 2 signed 64-bit integers vuint8x16 - 16 unsigned 8-bit integers vuint16x8 - 8 unsigned 16-bit integers vuint32x4 - 4 unsigned 32-bit integers vuint32x4 - 2 unsigned 64-bit integers all of these have many operations that are prefixed with the name of the type and an underscore, for example: vint8x16 vint8x16_splat(uint8_t x) - creates a vint8x16 where all of the values are filled with the value of `x' the current supported operations are: v[u]intAxB splat([u]intA_t x) creates a vector with all of the values are filled with the value of `x' v[u]intAxB load(const [u]intA_t x[B]) copies the values from the memory address stored at `x'; the address is NOT required to be aligned void store(v[u]intAxB vec, [u]intA_t x[B]) copies the values from the vector into the memory address stored at `x' like with load(), this does not require address alignment v[u]intAxB add(v[u]intAxB vec1, v[u]intAxB vec2) adds the value of `vec1' and `vec2' and returns it v[u]intAxB sub(v[u]intAxB vec1, v[u]intAxB vec2) subtracts the value of `vec2' from `vec1' and returns it v[u]intAxB mul(v[u]intAxB vec1, v[u]intAxB vec2) multiplies the values of `vec1' and `vec2' together and returns it