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

Function fill_buffer_with_pattern

cpp/src/gandiva/precompiled/string_ops.cc:2117–2131  ·  view source on GitHub ↗

Fill a buffer with repeated fill_text using O(log n) doubling strategy

Source from the content-addressed store, hash-verified

2115
2116// Fill a buffer with repeated fill_text using O(log n) doubling strategy
2117static FORCE_INLINE void fill_buffer_with_pattern(gdv_binary dest,
2118 gdv_int32 total_fill_bytes,
2119 const char* fill_text,
2120 gdv_int32 fill_text_len) {
2121 gdv_int32 initial_copy = std::min(fill_text_len, total_fill_bytes);
2122 memcpy(dest, fill_text, initial_copy);
2123 gdv_int32 written = initial_copy;
2124 while (written * 2 <= total_fill_bytes) {
2125 memcpy(dest + written, dest, written);
2126 written *= 2;
2127 }
2128 if (written < total_fill_bytes) {
2129 memcpy(dest + written, dest, total_fill_bytes - written);
2130 }
2131}
2132
2133FORCE_INLINE
2134const char* lpad_utf8_int32_utf8(gdv_int64 context, const char* text, gdv_int32 text_len,

Callers 2

lpad_utf8_int32_utf8Function · 0.85
rpad_utf8_int32_utf8Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected