4242 }
4343
4444 pub fn has_constraint ( & self ) -> bool {
45- ! self . constraint . is_some ( )
45+ self . constraint . is_none ( )
4646 }
4747
4848 pub fn type_and_name_from_c ( arg : & str ) -> ( & str , & str ) {
7474 pub fn from_c (
7575 pos : usize ,
7676 arg : & str ,
77- target : & String ,
77+ target : & str ,
7878 constraint : Option < Constraint > ,
7979 ) -> Argument < T > {
8080 let ( ty, var_name) = Self :: type_and_name_from_c ( arg) ;
@@ -136,15 +136,14 @@ where
136136 /// e.g `const int32x2_t a_vals = {0x3effffff, 0x3effffff, 0x3f7fffff}`, if loads=2.
137137 pub fn gen_arglists_c ( & self , indentation : Indentation , loads : u32 ) -> String {
138138 self . iter ( )
139- . filter_map ( |arg| {
140- ( !arg. has_constraint ( ) ) . then ( || {
141- format ! (
142- "{indentation}const {ty} {name}_vals[] = {values};" ,
143- ty = arg. ty. c_scalar_type( ) ,
144- name = arg. name,
145- values = arg. ty. populate_random( indentation, loads, & Language :: C )
146- )
147- } )
139+ . filter ( |& arg| !arg. has_constraint ( ) )
140+ . map ( |arg| {
141+ format ! (
142+ "{indentation}const {ty} {name}_vals[] = {values};" ,
143+ ty = arg. ty. c_scalar_type( ) ,
144+ name = arg. name,
145+ values = arg. ty. populate_random( indentation, loads, & Language :: C )
146+ )
148147 } )
149148 . collect :: < Vec < _ > > ( )
150149 . join ( "\n " )
@@ -154,17 +153,16 @@ where
154153 /// values can be loaded as a sliding window, e.g `const A_VALS: [u32; 20] = [...];`
155154 pub fn gen_arglists_rust ( & self , indentation : Indentation , loads : u32 ) -> String {
156155 self . iter ( )
157- . filter_map ( |arg| {
158- ( !arg. has_constraint ( ) ) . then ( || {
159- format ! (
160- "{indentation}{bind} {name}: [{ty}; {load_size}] = {values};" ,
161- bind = arg. rust_vals_array_binding( ) ,
162- name = arg. rust_vals_array_name( ) ,
163- ty = arg. ty. rust_scalar_type( ) ,
164- load_size = arg. ty. num_lanes( ) * arg. ty. num_vectors( ) + loads - 1 ,
165- values = arg. ty. populate_random( indentation, loads, & Language :: Rust )
166- )
167- } )
156+ . filter ( |& arg| !arg. has_constraint ( ) )
157+ . map ( |arg| {
158+ format ! (
159+ "{indentation}{bind} {name}: [{ty}; {load_size}] = {values};" ,
160+ bind = arg. rust_vals_array_binding( ) ,
161+ name = arg. rust_vals_array_name( ) ,
162+ ty = arg. ty. rust_scalar_type( ) ,
163+ load_size = arg. ty. num_lanes( ) * arg. ty. num_vectors( ) + loads - 1 ,
164+ values = arg. ty. populate_random( indentation, loads, & Language :: Rust )
165+ )
168166 } )
169167 . collect :: < Vec < _ > > ( )
170168 . join ( "\n " )
@@ -177,22 +175,18 @@ where
177175 /// ARM-specific
178176 pub fn load_values_c ( & self , indentation : Indentation ) -> String {
179177 self . iter ( )
180- . filter_map ( |arg| {
181- // The ACLE doesn't support 64-bit polynomial loads on Armv7
182- // This and the cast are a workaround for this
183-
184- ( !arg. has_constraint ( ) ) . then ( || {
185- format ! (
186- "{indentation}{ty} {name} = cast<{ty}>({load}(&{name}_vals[i]));\n " ,
187- ty = arg. to_c_type( ) ,
188- name = arg. name,
189- load = if arg. is_simd( ) {
190- arg. ty. get_load_function( Language :: C )
191- } else {
192- "*" . to_string( )
193- }
194- )
195- } )
178+ . filter ( |& arg| !arg. has_constraint ( ) )
179+ . map ( |arg| {
180+ format ! (
181+ "{indentation}{ty} {name} = cast<{ty}>({load}(&{name}_vals[i]));\n " ,
182+ ty = arg. to_c_type( ) ,
183+ name = arg. name,
184+ load = if arg. is_simd( ) {
185+ arg. ty. get_load_function( Language :: C )
186+ } else {
187+ "*" . to_string( )
188+ }
189+ )
196190 } )
197191 . collect ( )
198192 }
@@ -202,19 +196,18 @@ where
202196 /// e.g `let a = vld1_u8(A_VALS.as_ptr().offset(i));`
203197 pub fn load_values_rust ( & self , indentation : Indentation ) -> String {
204198 self . iter ( )
205- . filter_map ( |arg| {
206- ( !arg. has_constraint ( ) ) . then ( || {
207- format ! (
208- "{indentation}let {name} = {load}({vals_name}.as_ptr().offset(i));\n " ,
209- name = arg. name,
210- vals_name = arg. rust_vals_array_name( ) ,
211- load = if arg. is_simd( ) {
212- arg. ty. get_load_function( Language :: Rust )
213- } else {
214- "*" . to_string( )
215- } ,
216- )
217- } )
199+ . filter ( |& arg| !arg. has_constraint ( ) )
200+ . map ( |arg| {
201+ format ! (
202+ "{indentation}let {name} = {load}({vals_name}.as_ptr().offset(i));\n " ,
203+ name = arg. name,
204+ vals_name = arg. rust_vals_array_name( ) ,
205+ load = if arg. is_simd( ) {
206+ arg. ty. get_load_function( Language :: Rust )
207+ } else {
208+ "*" . to_string( )
209+ } ,
210+ )
218211 } )
219212 . collect ( )
220213 }
0 commit comments