3333 }
3434
3535 pub fn has_constraint ( & self ) -> bool {
36- ! self . constraint . is_some ( )
36+ self . constraint . is_none ( )
3737 }
3838
3939 pub fn type_and_name_from_c ( arg : & str ) -> ( & str , & str ) {
6565 pub fn from_c (
6666 pos : usize ,
6767 arg : & str ,
68- target : & String ,
68+ target : & str ,
6969 constraint : Option < Constraint > ,
7070 ) -> Argument < T > {
7171 let ( ty, var_name) = Self :: type_and_name_from_c ( arg) ;
@@ -127,15 +127,14 @@ where
127127 /// e.g `const int32x2_t a_vals = {0x3effffff, 0x3effffff, 0x3f7fffff}`, if loads=2.
128128 pub fn gen_arglists_c ( & self , indentation : Indentation , loads : u32 ) -> String {
129129 self . iter ( )
130- . filter_map ( |arg| {
131- ( !arg. has_constraint ( ) ) . then ( || {
132- format ! (
133- "{indentation}const {ty} {name}_vals[] = {values};" ,
134- ty = arg. ty. c_scalar_type( ) ,
135- name = arg. name,
136- values = arg. ty. populate_random( indentation, loads, & Language :: C )
137- )
138- } )
130+ . filter ( |& arg| !arg. has_constraint ( ) )
131+ . map ( |arg| {
132+ format ! (
133+ "{indentation}const {ty} {name}_vals[] = {values};" ,
134+ ty = arg. ty. c_scalar_type( ) ,
135+ name = arg. name,
136+ values = arg. ty. populate_random( indentation, loads, & Language :: C )
137+ )
139138 } )
140139 . collect :: < Vec < _ > > ( )
141140 . join ( "\n " )
@@ -145,17 +144,16 @@ where
145144 /// values can be loaded as a sliding window, e.g `const A_VALS: [u32; 20] = [...];`
146145 pub fn gen_arglists_rust ( & self , indentation : Indentation , loads : u32 ) -> String {
147146 self . iter ( )
148- . filter_map ( |arg| {
149- ( !arg. has_constraint ( ) ) . then ( || {
150- format ! (
151- "{indentation}{bind} {name}: [{ty}; {load_size}] = {values};" ,
152- bind = arg. rust_vals_array_binding( ) ,
153- name = arg. rust_vals_array_name( ) ,
154- ty = arg. ty. rust_scalar_type( ) ,
155- load_size = arg. ty. num_lanes( ) * arg. ty. num_vectors( ) + loads - 1 ,
156- values = arg. ty. populate_random( indentation, loads, & Language :: Rust )
157- )
158- } )
147+ . filter ( |& arg| !arg. has_constraint ( ) )
148+ . map ( |arg| {
149+ format ! (
150+ "{indentation}{bind} {name}: [{ty}; {load_size}] = {values};" ,
151+ bind = arg. rust_vals_array_binding( ) ,
152+ name = arg. rust_vals_array_name( ) ,
153+ ty = arg. ty. rust_scalar_type( ) ,
154+ load_size = arg. ty. num_lanes( ) * arg. ty. num_vectors( ) + loads - 1 ,
155+ values = arg. ty. populate_random( indentation, loads, & Language :: Rust )
156+ )
159157 } )
160158 . collect :: < Vec < _ > > ( )
161159 . join ( "\n " )
@@ -168,22 +166,18 @@ where
168166 /// ARM-specific
169167 pub fn load_values_c ( & self , indentation : Indentation ) -> String {
170168 self . iter ( )
171- . filter_map ( |arg| {
172- // The ACLE doesn't support 64-bit polynomial loads on Armv7
173- // This and the cast are a workaround for this
174-
175- ( !arg. has_constraint ( ) ) . then ( || {
176- format ! (
177- "{indentation}{ty} {name} = cast<{ty}>({load}(&{name}_vals[i]));\n " ,
178- ty = arg. to_c_type( ) ,
179- name = arg. name,
180- load = if arg. is_simd( ) {
181- arg. ty. get_load_function( Language :: C )
182- } else {
183- "*" . to_string( )
184- }
185- )
186- } )
169+ . filter ( |& arg| !arg. has_constraint ( ) )
170+ . map ( |arg| {
171+ format ! (
172+ "{indentation}{ty} {name} = cast<{ty}>({load}(&{name}_vals[i]));\n " ,
173+ ty = arg. to_c_type( ) ,
174+ name = arg. name,
175+ load = if arg. is_simd( ) {
176+ arg. ty. get_load_function( Language :: C )
177+ } else {
178+ "*" . to_string( )
179+ }
180+ )
187181 } )
188182 . collect ( )
189183 }
@@ -193,19 +187,18 @@ where
193187 /// e.g `let a = vld1_u8(A_VALS.as_ptr().offset(i));`
194188 pub fn load_values_rust ( & self , indentation : Indentation ) -> String {
195189 self . iter ( )
196- . filter_map ( |arg| {
197- ( !arg. has_constraint ( ) ) . then ( || {
198- format ! (
199- "{indentation}let {name} = {load}({vals_name}.as_ptr().offset(i));\n " ,
200- name = arg. name,
201- vals_name = arg. rust_vals_array_name( ) ,
202- load = if arg. is_simd( ) {
203- arg. ty. get_load_function( Language :: Rust )
204- } else {
205- "*" . to_string( )
206- } ,
207- )
208- } )
190+ . filter ( |& arg| !arg. has_constraint ( ) )
191+ . map ( |arg| {
192+ format ! (
193+ "{indentation}let {name} = {load}({vals_name}.as_ptr().offset(i));\n " ,
194+ name = arg. name,
195+ vals_name = arg. rust_vals_array_name( ) ,
196+ load = if arg. is_simd( ) {
197+ arg. ty. get_load_function( Language :: Rust )
198+ } else {
199+ "*" . to_string( )
200+ } ,
201+ )
209202 } )
210203 . collect ( )
211204 }
0 commit comments