Fill a buffer with repeated fill_text using O(log n) doubling strategy
| 2027 | |
| 2028 | // Fill a buffer with repeated fill_text using O(log n) doubling strategy |
| 2029 | static 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 | |
| 2045 | FORCE_INLINE |
| 2046 | const char* lpad_utf8_int32_utf8(gdv_int64 context, const char* text, gdv_int32 text_len, |
no outgoing calls
no test coverage detected