MCPcopy Create free account
hub / github.com/apache/arrow / UnpackFileGenerator

Class UnpackFileGenerator

cpp/src/arrow/util/bpacking_simd_codegen.py:215–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213
214@dataclasses.dataclass
215class UnpackFileGenerator:
216 generators: list[UnpackStructGenerator]
217
218 def print_license(self):
219 print(LICENSE)
220
221 def print_note(self):
222 print("// WARNING: this file is generated, DO NOT EDIT.")
223 print("// Usage:")
224 print(f"// python {' '.join(sys.orig_argv[1:])}")
225
226 def print_headers(self):
227 print("#include <cstdint>")
228 print("#include <cstring>")
229 print()
230 print("#include <xsimd/xsimd.hpp>")
231 print()
232 print('#include "arrow/util/ubsan.h"')
233
234 def print_file_top(self):
235 print("#pragma once")
236 print()
237 self.print_headers()
238 print()
239 print("namespace arrow::internal {")
240 print("namespace {")
241 print()
242 print("using ::arrow::util::SafeLoadAs;")
243
244 def print_file_bottom(self):
245 print("} // namespace")
246 print("} // namespace arrow::internal")
247
248 def print_structs(self):
249 delclared = set()
250
251 for gen in self.generators:
252 if gen.simd_bit_width not in delclared:
253 gen.print_struct_declaration()
254 print()
255 delclared.add(gen.simd_bit_width)
256
257 gen.print_structs()
258 print()
259
260 def print_file(self):
261 self.print_license()
262 self.print_note()
263 print()
264 self.print_file_top()
265 print()
266 self.print_structs()
267 self.print_file_bottom()
268
269
270def main(simd_width, outputs):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected