@@ -6,6 +6,7 @@ use super::intrinsic_helpers::IntrinsicTypeDefinition;
6
6
7
7
// The number of times each intrinsic will be called.
8
8
const PASSES : u32 = 20 ;
9
+ const COMMON_HEADERS : [ & str ; 5 ] = [ "iostream" , "string" , "cstring" , "iomanip" , "sstream" ] ;
9
10
10
11
pub fn generate_c_test_loop < T : IntrinsicTypeDefinition + Sized > (
11
12
w : & mut impl std:: io:: Write ,
@@ -99,7 +100,7 @@ pub fn write_mod_cpp<T: IntrinsicTypeDefinition>(
99
100
) -> std:: io:: Result < ( ) > {
100
101
write ! ( w, "{notice}" ) ?;
101
102
102
- for header in platform_headers {
103
+ for header in COMMON_HEADERS . iter ( ) . chain ( platform_headers. iter ( ) ) {
103
104
writeln ! ( w, "#include <{header}>" ) ?;
104
105
}
105
106
@@ -133,20 +134,13 @@ pub fn write_main_cpp<'a>(
133
134
arch_specific_headers : & [ & str ] ,
134
135
intrinsics : impl Iterator < Item = & ' a str > + Clone ,
135
136
) -> std:: io:: Result < ( ) > {
136
- writeln ! ( w, "#include <iostream>" ) ?;
137
- writeln ! ( w, "#include <string>" ) ?;
138
-
139
- for header in arch_specific_headers {
137
+ for header in COMMON_HEADERS . iter ( ) . chain ( arch_specific_headers. iter ( ) ) {
140
138
writeln ! ( w, "#include <{header}>" ) ?;
141
139
}
142
140
143
141
writeln ! (
144
142
w,
145
143
r#"
146
- #include <cstring>
147
- #include <iomanip>
148
- #include <sstream>
149
-
150
144
std::ostream& operator<<(std::ostream& os, float16_t value) {{
151
145
uint16_t temp = 0;
152
146
memcpy(&temp, &value, sizeof(float16_t));
0 commit comments