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:2029–2043  ·  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

2027
2028// Fill a buffer with repeated fill_text using O(log n) doubling strategy
2029static FORCE_INLINE void fill_buffer_with_pattern(gdv_binary dest,
2030 gdv_int32 total_fill_bytes,
2031 const char* fill_text,
2032 gdv_int32 fill_text_len) {
2033 gdv_int32 initial_copy = std::min(fill_text_len, total_fill_bytes);
2034 memcpy(dest, fill_text, initial_copy);
2035 gdv_int32 written = initial_copy;
2036 while (written * 2 <= total_fill_bytes) {
2037 memcpy(dest + written, dest, written);
2038 written *= 2;
2039 }
2040 if (written < total_fill_bytes) {
2041 memcpy(dest + written, dest, total_fill_bytes - written);
2042 }
2043}
2044
2045FORCE_INLINE
2046const 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