Fill a buffer with repeated fill_text using O(log n) doubling strategy
| 1970 | |
| 1971 | // Fill a buffer with repeated fill_text using O(log n) doubling strategy |
| 1972 | static FORCE_INLINE void fill_buffer_with_pattern(gdv_binary dest, |
| 1973 | gdv_int32 total_fill_bytes, |
| 1974 | const char* fill_text, |
| 1975 | gdv_int32 fill_text_len) { |
| 1976 | gdv_int32 initial_copy = std::min(fill_text_len, total_fill_bytes); |
| 1977 | memcpy(dest, fill_text, initial_copy); |
| 1978 | gdv_int32 written = initial_copy; |
| 1979 | while (written * 2 <= total_fill_bytes) { |
| 1980 | memcpy(dest + written, dest, written); |
| 1981 | written *= 2; |
| 1982 | } |
| 1983 | if (written < total_fill_bytes) { |
| 1984 | memcpy(dest + written, dest, total_fill_bytes - written); |
| 1985 | } |
| 1986 | } |
| 1987 | |
| 1988 | FORCE_INLINE |
| 1989 | const char* lpad_utf8_int32_utf8(gdv_int64 context, const char* text, gdv_int32 text_len, |
no outgoing calls
no test coverage detected