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

Function instr_utf8

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

Source from the content-addressed store, hash-verified

3182}
3183
3184FORCE_INLINE
3185int32_t instr_utf8(const char* string, int32_t string_len, const char* substring,
3186 int32_t substring_len) {
3187 if (substring_len == 0) {
3188 return 1;
3189 }
3190
3191 if (string_len < substring_len) {
3192 return 0;
3193 }
3194
3195 int32_t end_idx = string_len - substring_len;
3196
3197 for (int i = 0; i <= end_idx; i++) {
3198 if (string[i] == substring[0] &&
3199 memcmp((void*)(string + i), substring, substring_len) == 0) {
3200 return (i + 1);
3201 }
3202 }
3203 return 0;
3204}
3205} // extern "C"

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68