Mercurial > vec
diff README @ 2:f12b5dd4e18c
*: many new operations and a real test suite
author | Paper <paper@tflc.us> |
---|---|
date | Tue, 22 Oct 2024 22:39:05 -0400 |
parents | 02a517e4c492 |
children | e05c257c6a23 |
line wrap: on
line diff
--- a/README Tue Oct 22 01:28:48 2024 -0400 +++ b/README Tue Oct 22 22:39:05 2024 -0400 @@ -44,3 +44,65 @@ v[u]intAxB mul(v[u]intAxB vec1, v[u]intAxB vec2) multiplies the values of `vec1' and `vec2' together and returns it + + v[u]intAxB div(v[u]intAxB vec1, v[u]intAxB vec2) + divides vec1 by the values in vec2. dividing by zero is + considered defined behavior and should result in a zero; + if this doesn't happen it's considered a bug + + v[u]intAxB and(v[u]intAxB vec1, v[u]intAxB vec2) + bitwise AND (&) of the values in both vectors + + v[u]intAxB or(v[u]intAxB vec1, v[u]intAxB vec2) + bitwise OR (|) of the values in both vectors + + v[u]intAxB xor(v[u]intAxB vec1, v[u]intAxB vec2) + bitwise XOR (^) of the values in both vectors + + v[u]intAxB rshift(v[u]intAxB vec1, vuintAxB vec2) + arithmetic right shift of the values in vec1 by + the corresponding values in vec2 + + v[u]intAxB lshift(v[u]intAxB vec1, vuintAxB vec2) + arithmetic left shift of the values in vec1 by + the corresponding values in vec2 + + v[u]intAxB lrshift(v[u]intAxB vec1, vuintAxB vec2) + logical right shift of the values in vec1 by + the corresponding values in vec2 + + v[u]intAxB avg(v[u]intAxB vec1, v[u]intAxB vec2) + returns the average of the values in both vectors + i.e., div(mul(vec1, vec2), splat(2)) + +there are also a number of comparisons possible: + + v[u]intAxB cmplt(v[u]intAxB vec1, v[u]intAxB vec2) + turns on all bits of the corresponding value in + the result vector if the value in `vec1' is less + than the corresponding value in `vec2', else all + of the bits are turned off. + + v[u]intAxB cmpgt(v[u]intAxB vec1, v[u]intAxB vec2) + turns on all bits of the corresponding value in + the result vector if the value in `vec1' is greater + than the corresponding value in `vec2', else all + of the bits are turned off. + + v[u]intAxB cmpeq(v[u]intAxB vec1, v[u]intAxB vec2) + turns on all bits of the corresponding value in + the result vector if the value in `vec1' are equal + to the corresponding value in `vec2', else all + of the bits are turned off. + + v[u]intAxB cmple(v[u]intAxB vec1, v[u]intAxB vec2) + turns on all bits of the corresponding value in + the result vector if the value in `vec1' is less + than or equal to the corresponding value in `vec2', + else all of the bits are turned off. + + v[u]intAxB cmpge(v[u]intAxB vec1, v[u]intAxB vec2) + turns on all bits of the corresponding value in + the result vector if the value in `vec1' is greater + than or equal to the corresponding value in `vec2', + else all of the bits are turned off.