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

Function instr_utf8

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

Source from the content-addressed store, hash-verified

3041}
3042
3043FORCE_INLINE
3044int32_t instr_utf8(const char* string, int32_t string_len, const char* substring,
3045 int32_t substring_len) {
3046 if (substring_len == 0) {
3047 return 1;
3048 }
3049
3050 if (string_len < substring_len) {
3051 return 0;
3052 }
3053
3054 int32_t end_idx = string_len - substring_len;
3055
3056 for (int i = 0; i <= end_idx; i++) {
3057 if (string[i] == substring[0] &&
3058 memcmp((void*)(string + i), substring, substring_len) == 0) {
3059 return (i + 1);
3060 }
3061 }
3062 return 0;
3063}
3064} // extern "C"

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68