MCPcopy Create free account
hub / github.com/ashvardanian/StringZilla / sz_move_neon

Function sz_move_neon

include/stringzilla/memory.h:1111–1134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1109}
1110
1111SZ_PUBLIC void sz_move_neon(sz_ptr_t target, sz_cptr_t source, sz_size_t length) {
1112 // When moving small buffers, using a small buffer on stack as a temporary storage is faster.
1113
1114 if (target < source || target >= source + length) {
1115 // Non-overlapping, proceed forward
1116 sz_copy_neon(target, source, length);
1117 }
1118 else {
1119 // Overlapping, proceed backward
1120 target += length;
1121 source += length;
1122
1123 sz_u128_vec_t src_vec;
1124 while (length >= 16) {
1125 target -= 16, source -= 16, length -= 16;
1126 src_vec.u8x16 = vld1q_u8((sz_u8_t const *)source);
1127 vst1q_u8((sz_u8_t *)target, src_vec.u8x16);
1128 }
1129 while (length) {
1130 target -= 1, source -= 1, length -= 1;
1131 *target = *source;
1132 }
1133 }
1134}
1135
1136SZ_PUBLIC void sz_fill_neon(sz_ptr_t target, sz_size_t length, sz_u8_t value) {
1137 uint8x16_t fill_vec = vdupq_n_u8(value); // Broadcast the value across the register

Callers 1

sz_moveFunction · 0.85

Calls 1

sz_copy_neonFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…