@@ -27,8 +27,19 @@ macro_rules! index {
27
27
( $m: ident $arg: tt 7 ) => ( $m!( $arg 0 1 2 3 4 5 6 ) ) ;
28
28
}
29
29
30
+ macro_rules! index_item_ix {
31
+ ( $m: ident $arg: tt 0 ) => ( $m!( $arg) ; ) ;
32
+ ( $m: ident $arg: tt 1 ) => ( $m!( $arg Ix ) ; ) ;
33
+ ( $m: ident $arg: tt 2 ) => ( $m!( $arg Ix Ix ) ; ) ;
34
+ ( $m: ident $arg: tt 3 ) => ( $m!( $arg Ix Ix Ix ) ; ) ;
35
+ ( $m: ident $arg: tt 4 ) => ( $m!( $arg Ix Ix Ix Ix ) ; ) ;
36
+ ( $m: ident $arg: tt 5 ) => ( $m!( $arg Ix Ix Ix Ix Ix ) ; ) ;
37
+ ( $m: ident $arg: tt 6 ) => ( $m!( $arg Ix Ix Ix Ix Ix Ix ) ; ) ;
38
+ ( $m: ident $arg: tt 7 ) => ( $m!( $arg Ix Ix Ix Ix Ix Ix Ix ) ; ) ;
39
+ }
40
+
30
41
macro_rules! index_item {
31
- ( $m: ident $arg: tt 0 ) => ( ) ;
42
+ ( $m: ident $arg: tt 0 ) => ( $m! ( $arg ) ; ) ;
32
43
( $m: ident $arg: tt 1 ) => ( $m!( $arg 0 ) ; ) ;
33
44
( $m: ident $arg: tt 2 ) => ( $m!( $arg 0 1 ) ; ) ;
34
45
( $m: ident $arg: tt 3 ) => ( $m!( $arg 0 1 2 ) ; ) ;
@@ -98,8 +109,14 @@ macro_rules! array_zero {
98
109
macro_rules! tuple_to_array {
99
110
( [ ] $( $n: tt) * ) => {
100
111
$(
112
+ index_item_ix!( impl_tuple_to_array [ $n] $n) ;
113
+ ) *
114
+ }
115
+ }
116
+ macro_rules! impl_tuple_to_array {
117
+ ( [ $n: tt] $( $ix: tt) * ) => {
101
118
impl Convert for [ Ix ; $n] {
102
- type To = index! ( tuple_type [ Ix ] $n ) ;
119
+ type To = ( $ ( $ix , ) * ) ;
103
120
fn convert( self ) -> Self :: To {
104
121
index!( tuple_expr [ self ] $n)
105
122
}
@@ -113,7 +130,7 @@ macro_rules! tuple_to_array {
113
130
}
114
131
}
115
132
116
- impl IntoDimension for index! ( tuple_type [ Ix ] $n ) {
133
+ impl IntoDimension for ( $ ( $ix , ) * ) {
117
134
type Dim = Dim <[ Ix ; $n] >;
118
135
#[ inline( always) ]
119
136
fn into_dimension( self ) -> Self :: Dim {
@@ -145,8 +162,6 @@ macro_rules! tuple_to_array {
145
162
self . slice( ) . iter( ) . all( |x| * x == 0 )
146
163
}
147
164
}
148
-
149
- ) *
150
165
}
151
166
}
152
167
0 commit comments