Mercurial > vec
comparison README @ 40:55cadb1fac4b
*: add mod operation, add GCC vector backend
need to test it with old gcc though. :)
author | Paper <paper@tflc.us> |
---|---|
date | Sun, 27 Apr 2025 02:49:53 -0400 |
parents | f9ca85d2f14c |
children |
comparison
equal
deleted
inserted
replaced
39:f9ca85d2f14c | 40:55cadb1fac4b |
---|---|
61 v[u]intAxB div(v[u]intAxB vec1, v[u]intAxB vec2) | 61 v[u]intAxB div(v[u]intAxB vec1, v[u]intAxB vec2) |
62 divides vec1 by the values in vec2. dividing by zero is | 62 divides vec1 by the values in vec2. dividing by zero is |
63 considered defined behavior and should result in a zero; | 63 considered defined behavior and should result in a zero; |
64 if this doesn't happen it's considered a bug | 64 if this doesn't happen it's considered a bug |
65 | 65 |
66 v[u]intAxB mod(v[u]intAxB vec1, v[u]intAxB vec2) | |
67 gives the remainder of a division operation. as with div, | |
68 divide-by-zero is defined behavior. | |
69 | |
66 v[u]intAxB and(v[u]intAxB vec1, v[u]intAxB vec2) | 70 v[u]intAxB and(v[u]intAxB vec1, v[u]intAxB vec2) |
67 bitwise AND (&) of the values in both vectors | 71 bitwise AND (&) of the values in both vectors |
68 | 72 |
69 v[u]intAxB or(v[u]intAxB vec1, v[u]intAxB vec2) | 73 v[u]intAxB or(v[u]intAxB vec1, v[u]intAxB vec2) |
70 bitwise OR (|) of the values in both vectors | 74 bitwise OR (|) of the values in both vectors |
85 the corresponding values in vec2 | 89 the corresponding values in vec2 |
86 | 90 |
87 v[u]intAxB avg(v[u]intAxB vec1, v[u]intAxB vec2) | 91 v[u]intAxB avg(v[u]intAxB vec1, v[u]intAxB vec2) |
88 returns the average of the values in both vectors | 92 returns the average of the values in both vectors |
89 i.e., div(add(vec1, vec2), splat(2)), without | 93 i.e., div(add(vec1, vec2), splat(2)), without |
90 the possibility of overflow. | 94 the possibility of overflow. If you are familiar |
95 with AltiVec, this operation exactly mimics | |
96 vec_avg. | |
91 | 97 |
92 v[u]intAxB min(v[u]intAxB vec1, v[u]intAxB vec2) | 98 v[u]intAxB min(v[u]intAxB vec1, v[u]intAxB vec2) |
93 returns the minimum of the values in both vectors | 99 returns the minimum of the values in both vectors |
94 | 100 |
95 v[u]intAxB max(v[u]intAxB vec1, v[u]intAxB vec2) | 101 v[u]intAxB max(v[u]intAxB vec1, v[u]intAxB vec2) |