MCPcopy Create free account
hub / github.com/F-Stack/f-stack / posrelat

Function posrelat

freebsd/contrib/openzfs/module/lua/lstrlib.c:56–60  ·  view source on GitHub ↗

translate a relative string position: negative means back from end */

Source from the content-addressed store, hash-verified

54
55/* translate a relative string position: negative means back from end */
56static size_t posrelat (ptrdiff_t pos, size_t len) {
57 if (pos >= 0) return (size_t)pos;
58 else if (0u - (size_t)pos > len) return 0;
59 else return len - ((size_t)-pos) + 1;
60}
61
62
63static int str_sub (lua_State *L) {

Callers 3

str_subFunction · 0.70
str_byteFunction · 0.70
str_find_auxFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected