Lines Matching refs:t
7 ($t:ident, $new:ident, $vec4:ident, $vec3:ident, $vec2:ident, $mask:ident) => {
9 const V0: $vec4 = $vec4::splat(1 as $t);
10 const V1: $vec4 = $vec4::new(1 as $t, 2 as $t, 3 as $t, 4 as $t);
11 const V2: $vec4 = $vec4::from_array([1 as $t, 2 as $t, 3 as $t, 4 as $t]);
12 assert_eq!([1 as $t, 1 as $t, 1 as $t, 1 as $t], *V0.as_ref());
13 assert_eq!([1 as $t, 2 as $t, 3 as $t, 4 as $t], *V1.as_ref());
14 assert_eq!([1 as $t, 2 as $t, 3 as $t, 4 as $t], *V2.as_ref());
18 assert_eq!($vec4::ZERO, $new(0 as $t, 0 as $t, 0 as $t, 0 as $t));
19 assert_eq!($vec4::ONE, $new(1 as $t, 1 as $t, 1 as $t, 1 as $t));
20 assert_eq!($vec4::X, $new(1 as $t, 0 as $t, 0 as $t, 0 as $t));
21 assert_eq!($vec4::Y, $new(0 as $t, 1 as $t, 0 as $t, 0 as $t));
22 assert_eq!($vec4::Z, $new(0 as $t, 0 as $t, 1 as $t, 0 as $t));
23 assert_eq!($vec4::W, $new(0 as $t, 0 as $t, 0 as $t, 1 as $t));
27 let v = $new(1 as $t, 2 as $t, 3 as $t, 4 as $t);
29 assert_eq!(v.x, 1 as $t);
30 assert_eq!(v.y, 2 as $t);
31 assert_eq!(v.z, 3 as $t);
32 assert_eq!(v.w, 4 as $t);
34 let t = (1 as $t, 2 as $t, 3 as $t, 4 as $t); localVariable
35 let v = $vec4::from(t);
36 assert_eq!(t, v.into());
38 let a = [1 as $t, 2 as $t, 3 as $t, 4 as $t];
40 let a1: [$t; 4] = v.into();
50 let v = $vec4::new(t.0, t.1, t.2, t.3);
51 assert_eq!(t, v.into());
53 assert_eq!($vec4::new(1 as $t, 0 as $t, 0 as $t, 0 as $t), $vec4::X);
54 assert_eq!($vec4::new(0 as $t, 1 as $t, 0 as $t, 0 as $t), $vec4::Y);
55 assert_eq!($vec4::new(0 as $t, 0 as $t, 1 as $t, 0 as $t), $vec4::Z);
56 assert_eq!($vec4::new(0 as $t, 0 as $t, 0 as $t, 1 as $t), $vec4::W);
60 $vec4::from(($vec3::new(1 as $t, 2 as $t, 3 as $t), 4 as $t))
65 $vec4::from((1 as $t, $vec3::new(2 as $t, 3 as $t, 4 as $t)))
70 $vec4::from(($vec2::new(1 as $t, 2 as $t), 3 as $t, 4 as $t))
74 $vec4::from(($vec2::new(1 as $t, 2 as $t), $vec2::new(3 as $t, 4 as $t)))
79 let a = $vec4::new(1 as $t, 2 as $t, 3 as $t, 4 as $t);
107 assert_eq!((0 as $t, 0 as $t, 0 as $t, 0 as $t), v.into());
112 let v = $vec4::splat(1 as $t);
118 a.x = 1 as $t;
119 a.y = 2 as $t;
120 a.z = 3 as $t;
121 a.w = 4 as $t;
122 assert_eq!(1 as $t, a.x);
123 assert_eq!(2 as $t, a.y);
124 assert_eq!(3 as $t, a.z);
125 assert_eq!(4 as $t, a.w);
126 assert_eq!((1 as $t, 2 as $t, 3 as $t, 4 as $t), a.into());
129 a[0] = 1 as $t;
130 a[1] = 2 as $t;
131 a[2] = 3 as $t;
132 a[3] = 4 as $t;
133 assert_eq!(1 as $t, a[0]);
134 assert_eq!(2 as $t, a[1]);
135 assert_eq!(3 as $t, a[2]);
136 assert_eq!(4 as $t, a[3]);
137 assert_eq!((1 as $t, 2 as $t, 3 as $t, 4 as $t), a.into());
141 let x = $new(1 as $t, 0 as $t, 0 as $t, 0 as $t);
142 let y = $new(0 as $t, 1 as $t, 0 as $t, 0 as $t);
143 let z = $new(0 as $t, 0 as $t, 1 as $t, 0 as $t);
144 let w = $new(0 as $t, 0 as $t, 0 as $t, 1 as $t);
145 assert_eq!(1 as $t, x.dot(x));
146 assert_eq!(0 as $t, x.dot(y));
147 assert_eq!(0 as $t, y.dot(z));
148 assert_eq!(0 as $t, z.dot(w));
152 let a = $new(2 as $t, 4 as $t, 8 as $t, 16 as $t);
153 assert_eq!($new(4 as $t, 8 as $t, 16 as $t, 32 as $t), a + a);
154 assert_eq!($new(2 as $t, 4 as $t, 8 as $t, 16 as $t), 0 as $t + a);
155 assert_eq!($new(0 as $t, 0 as $t, 0 as $t, 0 as $t), a - a);
156 assert_eq!($new(14 as $t, 12 as $t, 8 as $t, 0 as $t), 16 as $t - a);
157 assert_eq!($new(4 as $t, 16 as $t, 64 as $t, 256 as $t), a * a);
158 assert_eq!($new(4 as $t, 8 as $t, 16 as $t, 32 as $t), a * 2 as $t);
159 assert_eq!($new(4 as $t, 8 as $t, 16 as $t, 32 as $t), 2 as $t * a);
160 assert_eq!($new(1 as $t, 1 as $t, 1 as $t, 1 as $t), a / a);
161 assert_eq!($new(1 as $t, 2 as $t, 4 as $t, 8 as $t), a / 2 as $t);
162 assert_eq!($new(8 as $t, 4 as $t, 2 as $t, 1 as $t), 16 as $t / a);
163 assert_eq!($new(0 as $t, 0 as $t, 0 as $t, 0 as $t), a % a);
164 assert_eq!($new(0 as $t, 1 as $t, 1 as $t, 1 as $t), a % (a - 1 as $t));
165 assert_eq!($new(0 as $t, 0 as $t, 0 as $t, 0 as $t), a % 1 as $t);
166 assert_eq!($new(2 as $t, 1 as $t, 2 as $t, 1 as $t), a % 3 as $t);
167 assert_eq!($new(1 as $t, 1 as $t, 1 as $t, 1 as $t), 17 as $t % a);
168 assert_eq!($new(2 as $t, 4 as $t, 0 as $t, 0 as $t), a % 8 as $t);
172 let a = $new(1 as $t, 2 as $t, 3 as $t, 4 as $t);
175 b += 2 as $t;
176 assert_eq!($new(3 as $t, 4 as $t, 5 as $t, 6 as $t), b);
177 b -= 2 as $t;
178 assert_eq!($new(1 as $t, 2 as $t, 3 as $t, 4 as $t), b);
179 b *= 2 as $t;
180 assert_eq!($new(2 as $t, 4 as $t, 6 as $t, 8 as $t), b);
181 b /= 2 as $t;
182 assert_eq!($new(1 as $t, 2 as $t, 3 as $t, 4 as $t), b);
183 b %= 2 as $t;
184 assert_eq!($new(1 as $t, 0 as $t, 1 as $t, 0 as $t), b);
188 assert_eq!($new(2 as $t, 4 as $t, 6 as $t, 8 as $t), b);
190 assert_eq!($new(1 as $t, 2 as $t, 3 as $t, 4 as $t), b);
192 assert_eq!($new(1 as $t, 4 as $t, 9 as $t, 16 as $t), b);
194 assert_eq!($new(1 as $t, 2 as $t, 3 as $t, 4 as $t), b);
195 b *= 2 as $t;
196 assert_eq!($new(2 as $t, 4 as $t, 6 as $t, 8 as $t), b);
197 b /= 2 as $t;
198 assert_eq!($new(1 as $t, 2 as $t, 3 as $t, 4 as $t), b);
199 b %= (b + 1 as $t);
200 assert_eq!($new(1 as $t, 2 as $t, 3 as $t, 4 as $t), b);
202 assert_eq!($new(0 as $t, 0 as $t, 0 as $t, 0 as $t), b);
206 let a = $new(4 as $t, 6 as $t, 2 as $t, 8 as $t);
207 let b = $new(5 as $t, 3 as $t, 7 as $t, 1 as $t);
208 assert_eq!((4 as $t, 3 as $t, 2 as $t, 1 as $t), a.min(b).into());
209 assert_eq!((4 as $t, 3 as $t, 2 as $t, 1 as $t), b.min(a).into());
210 assert_eq!((5 as $t, 6 as $t, 7 as $t, 8 as $t), a.max(b).into());
211 assert_eq!((5 as $t, 6 as $t, 7 as $t, 8 as $t), b.max(a).into());
216 $vec4::new(x as $t, y as $t, z as $t, w as $t)
232 1 as $t,
233 $new(1 as $t, 2 as $t, 3 as $t, 4 as $t).min_element()
236 1 as $t,
237 $new(4 as $t, 1 as $t, 2 as $t, 3 as $t).min_element()
240 1 as $t,
241 $new(3 as $t, 4 as $t, 1 as $t, 2 as $t).min_element()
244 1 as $t,
245 $new(2 as $t, 3 as $t, 4 as $t, 1 as $t).min_element()
248 4 as $t,
249 $new(1 as $t, 2 as $t, 3 as $t, 4 as $t).max_element()
252 4 as $t,
253 $new(4 as $t, 1 as $t, 2 as $t, 3 as $t).max_element()
256 4 as $t,
257 $new(3 as $t, 4 as $t, 1 as $t, 2 as $t).max_element()
260 4 as $t,
261 $new(2 as $t, 3 as $t, 4 as $t, 1 as $t).max_element()
264 3 as $t,
265 $new(1 as $t, 2 as $t, 3 as $t, 4 as $t)
270 2 as $t,
271 $new(4 as $t, 3 as $t, 2 as $t, 1 as $t)
278 let a = $new(1 as $t, 1 as $t, 1 as $t, 1 as $t);
279 let b = $new(1 as $t, 2 as $t, 3 as $t, 4 as $t);
291 let a = $new(1 as $t, 1 as $t, 1 as $t, 1 as $t);
292 let b = $new(2 as $t, 2 as $t, 2 as $t, 2 as $t);
293 let c = $new(1 as $t, 1 as $t, 2 as $t, 2 as $t);
294 let d = $new(2 as $t, 1 as $t, 1 as $t, 2 as $t);
320 let a = [1 as $t, 2 as $t, 3 as $t, 4 as $t];
322 let c: [$t; 4] = b.into();
324 let mut d = [0 as $t, 0 as $t, 0 as $t, 0 as $t];
328 should_panic!({ $vec4::ONE.write_to_slice(&mut [0 as $t; 3]) });
329 should_panic!({ $vec4::from_slice(&[0 as $t; 3]) });
417 let a = $vec4::new(1 as $t, 2 as $t, 3 as $t, 4 as $t);
418 let b = $vec4::new(5 as $t, 6 as $t, 7 as $t, 8 as $t);
421 $vec4::new(1 as $t, 2 as $t, 3 as $t, 4 as $t),
425 $vec4::new(1 as $t, 6 as $t, 3 as $t, 8 as $t),
429 $vec4::new(5 as $t, 2 as $t, 7 as $t, 4 as $t),
433 $vec4::new(5 as $t, 6 as $t, 7 as $t, 8 as $t),
571 let v = $vec4::new(1 as $t, 2 as $t, 3 as $t, 4 as $t);
572 let mut a = [0 as $t, 0 as $t, 0 as $t, 0 as $t];
584 let two = $vec4::new(2 as $t, 2 as $t, 2 as $t, 2 as $t);
592 ($t:ident, $new:ident, $vec4:ident, $vec3:ident, $vec2:ident, $mask:ident) => {
593 impl_vec4_tests!($t, $new, $vec4, $vec3, $vec2, $mask);
596 let a = $new(1 as $t, 2 as $t, 3 as $t, 4 as $t);
597 assert_eq!((-1 as $t, -2 as $t, -3 as $t, -4 as $t), (-a).into());
599 $new(-0.0 as $t, -0.0 as $t, -0.0 as $t, -0.0 as $t),
600 -$new(0.0 as $t, 0.0 as $t, 0.0 as $t, 0.0 as $t)
603 $new(0.0 as $t, -0.0 as $t, -0.0 as $t, -0.0 as $t),
604 -$new(-0.0 as $t, 0.0 as $t, 0.0 as $t, 0.0 as $t)
609 let x = $new(1 as $t, 0 as $t, 0 as $t, 0 as $t);
610 let y = $new(0 as $t, 1 as $t, 0 as $t, 0 as $t);
611 let z = $new(0 as $t, 0 as $t, 1 as $t, 0 as $t);
612 let w = $new(0 as $t, 0 as $t, 0 as $t, 1 as $t);
613 assert_eq!(1 as $t, x.dot(x));
614 assert_eq!(0 as $t, x.dot(y));
615 assert_eq!(0 as $t, x.dot(-z));
616 assert_eq!(-1 as $t, w.dot(-w));
622 ($t:ident, $new:ident) => {
628 let a = $new(1 as $t, 2 as $t, 3 as $t, 4 as $t);
629 let b = $new(1 as $t, 2 as $t, 3 as $t, 4 as $t);
630 let c = $new(3 as $t, 2 as $t, 1 as $t, 4 as $t);
653 ($t:ident, $new:ident, $vec4:ident, $vec3:ident, $vec2:ident, $mask:ident) => {
654 impl_vec4_signed_tests!($t, $new, $vec4, $vec3, $vec2, $mask);
655 impl_vec_float_normalize_tests!($t, $vec4);
657 use core::$t::INFINITY;
658 use core::$t::NAN;
659 use core::$t::NEG_INFINITY;
681 assert_eq!((2.0 as $t).sqrt(), w.distance(y));
698 (2.0 as $t * 2.0 + 3.0 * 3.0 + 4.0 * 4.0 + 5.0 * 5.0).sqrt(),
702 1.0 / (2.0 as $t * 2.0 + 3.0 * 3.0 + 4.0 * 4.0 + 5.0 * 5.0).sqrt(),
708 / (2.0 as $t * 2.0 + 3.0 * 3.0 + 4.0 * 4.0 + 5.0 * 5.0).sqrt(),
907 (1.0 as $t).exp(),
908 (2.0 as $t).exp(),
909 (3.0 as $t).exp(),
910 (4.0 as $t).exp()