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

Function sz_lookup_serial

include/stringzilla/memory.h:308–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306#pragma region Serial Implementation
307
308SZ_PUBLIC void sz_lookup_serial(sz_ptr_t result, sz_size_t length, sz_cptr_t text, char const lut[sz_at_least_(256)]) {
309 sz_u8_t const *unsigned_lut = (sz_u8_t const *)lut;
310 sz_u8_t const *unsigned_text = (sz_u8_t const *)text;
311 sz_u8_t *unsigned_result = (sz_u8_t *)result;
312 sz_u8_t const *end = unsigned_text + length;
313 for (; unsigned_text != end; ++unsigned_text, ++unsigned_result) *unsigned_result = unsigned_lut[*unsigned_text];
314}
315
316// When overriding libc, disable optimizations for this function because MSVC will optimize the loops into a `memset`.
317// Which then causes a stack overflow due to infinite recursion (`memset` -> `sz_fill_serial` -> `memset`).

Callers 5

sz_lookup_haswellFunction · 0.85
sz_lookup_iceFunction · 0.85
sz_lookup_neonFunction · 0.85
sz_lookup_sveFunction · 0.85
sz_lookupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…