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

Function MakeHexStrings

cpp/src/arrow/util/value_parsing_benchmark.cc:60–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58
59template <typename c_int>
60static std::vector<std::string> MakeHexStrings(int32_t num_items) {
61 int32_t num_bytes = sizeof(c_int);
62 const char* kAsciiTable = "0123456789ABCDEF";
63 std::vector<char> large_hex_chars(num_bytes * 2 + 2);
64 large_hex_chars[0] = '0';
65 large_hex_chars[1] = 'x';
66 for (int32_t i = 0; i < num_bytes * 2; ++i) {
67 large_hex_chars[i + 2] = kAsciiTable[i];
68 }
69 std::string large_hex(&large_hex_chars[0], large_hex_chars.size());
70
71 std::vector<std::string> base_strings = {"0x0", "0xA5", "0x5E", large_hex};
72 std::vector<std::string> strings;
73 for (int32_t i = 0; i < num_items; ++i) {
74 strings.push_back(base_strings[i % base_strings.size()]);
75 }
76 return strings;
77}
78
79static std::vector<std::string> MakeFloatStrings(int32_t num_items) {
80 std::vector<std::string> base_strings = {"0.0", "5", "-12.3",

Callers

nothing calls this directly

Calls 2

push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected