Mercurial > vec
comparison 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 |
comparison
equal
deleted
inserted
replaced
1:1d9d2308c1d2 | 2:f12b5dd4e18c |
---|---|
42 subtracts the value of `vec2' from `vec1' and returns it | 42 subtracts the value of `vec2' from `vec1' and returns it |
43 | 43 |
44 v[u]intAxB mul(v[u]intAxB vec1, v[u]intAxB vec2) | 44 v[u]intAxB mul(v[u]intAxB vec1, v[u]intAxB vec2) |
45 multiplies the values of `vec1' and `vec2' together and | 45 multiplies the values of `vec1' and `vec2' together and |
46 returns it | 46 returns it |
47 | |
48 v[u]intAxB div(v[u]intAxB vec1, v[u]intAxB vec2) | |
49 divides vec1 by the values in vec2. dividing by zero is | |
50 considered defined behavior and should result in a zero; | |
51 if this doesn't happen it's considered a bug | |
52 | |
53 v[u]intAxB and(v[u]intAxB vec1, v[u]intAxB vec2) | |
54 bitwise AND (&) of the values in both vectors | |
55 | |
56 v[u]intAxB or(v[u]intAxB vec1, v[u]intAxB vec2) | |
57 bitwise OR (|) of the values in both vectors | |
58 | |
59 v[u]intAxB xor(v[u]intAxB vec1, v[u]intAxB vec2) | |
60 bitwise XOR (^) of the values in both vectors | |
61 | |
62 v[u]intAxB rshift(v[u]intAxB vec1, vuintAxB vec2) | |
63 arithmetic right shift of the values in vec1 by | |
64 the corresponding values in vec2 | |
65 | |
66 v[u]intAxB lshift(v[u]intAxB vec1, vuintAxB vec2) | |
67 arithmetic left shift of the values in vec1 by | |
68 the corresponding values in vec2 | |
69 | |
70 v[u]intAxB lrshift(v[u]intAxB vec1, vuintAxB vec2) | |
71 logical right shift of the values in vec1 by | |
72 the corresponding values in vec2 | |
73 | |
74 v[u]intAxB avg(v[u]intAxB vec1, v[u]intAxB vec2) | |
75 returns the average of the values in both vectors | |
76 i.e., div(mul(vec1, vec2), splat(2)) | |
77 | |
78 there are also a number of comparisons possible: | |
79 | |
80 v[u]intAxB cmplt(v[u]intAxB vec1, v[u]intAxB vec2) | |
81 turns on all bits of the corresponding value in | |
82 the result vector if the value in `vec1' is less | |
83 than the corresponding value in `vec2', else all | |
84 of the bits are turned off. | |
85 | |
86 v[u]intAxB cmpgt(v[u]intAxB vec1, v[u]intAxB vec2) | |
87 turns on all bits of the corresponding value in | |
88 the result vector if the value in `vec1' is greater | |
89 than the corresponding value in `vec2', else all | |
90 of the bits are turned off. | |
91 | |
92 v[u]intAxB cmpeq(v[u]intAxB vec1, v[u]intAxB vec2) | |
93 turns on all bits of the corresponding value in | |
94 the result vector if the value in `vec1' are equal | |
95 to the corresponding value in `vec2', else all | |
96 of the bits are turned off. | |
97 | |
98 v[u]intAxB cmple(v[u]intAxB vec1, v[u]intAxB vec2) | |
99 turns on all bits of the corresponding value in | |
100 the result vector if the value in `vec1' is less | |
101 than or equal to the corresponding value in `vec2', | |
102 else all of the bits are turned off. | |
103 | |
104 v[u]intAxB cmpge(v[u]intAxB vec1, v[u]intAxB vec2) | |
105 turns on all bits of the corresponding value in | |
106 the result vector if the value in `vec1' is greater | |
107 than or equal to the corresponding value in `vec2', | |
108 else all of the bits are turned off. |