File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,42 @@ macro_rules! impl_traits {
35
35
iter. product:: <crate :: $type<LANES >>( ) . horizontal_product( )
36
36
}
37
37
}
38
+
39
+ impl <' a, const LANES : usize > core:: iter:: Sum <& ' a Self > for crate :: $type<LANES >
40
+ where
41
+ Self : crate :: LanesAtMost32 ,
42
+ {
43
+ fn sum<I : core:: iter:: Iterator <Item = & ' a Self >>( iter: I ) -> Self {
44
+ iter. fold( Default :: default ( ) , core:: ops:: Add :: add)
45
+ }
46
+ }
47
+
48
+ impl <' a, const LANES : usize > core:: iter:: Product <& ' a Self > for crate :: $type<LANES >
49
+ where
50
+ Self : crate :: LanesAtMost32 ,
51
+ {
52
+ fn product<I : core:: iter:: Iterator <Item = & ' a Self >>( iter: I ) -> Self {
53
+ iter. fold( Default :: default ( ) , core:: ops:: Mul :: mul)
54
+ }
55
+ }
56
+
57
+ impl <' a, const LANES : usize > core:: iter:: Sum <& ' a crate :: $type<LANES >> for $scalar
58
+ where
59
+ crate :: $type<LANES >: crate :: LanesAtMost32 ,
60
+ {
61
+ fn sum<I : core:: iter:: Iterator <Item = & ' a crate :: $type<LANES >>>( iter: I ) -> Self {
62
+ iter. sum:: <crate :: $type<LANES >>( ) . horizontal_sum( )
63
+ }
64
+ }
65
+
66
+ impl <' a, const LANES : usize > core:: iter:: Product <& ' a crate :: $type<LANES >> for $scalar
67
+ where
68
+ crate :: $type<LANES >: crate :: LanesAtMost32 ,
69
+ {
70
+ fn product<I : core:: iter:: Iterator <Item = & ' a crate :: $type<LANES >>>( iter: I ) -> Self {
71
+ iter. product:: <crate :: $type<LANES >>( ) . horizontal_product( )
72
+ }
73
+ }
38
74
}
39
75
}
40
76
You can’t perform that action at this time.
0 commit comments