MCPcopy Create free account
hub / github.com/DFHack/dfhack / u_posrelat

Function u_posrelat

depends/lua/src/lutf8lib.c:30–34  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

28/* from strlib */
29/* translate a relative string position: negative means back from end */
30static lua_Integer u_posrelat (lua_Integer pos, size_t len) {
31 if (pos >= 0) return pos;
32 else if (0u - (size_t)pos > len) return 0;
33 else return (lua_Integer)len + pos + 1;
34}
35
36
37/*

Callers 3

utflenFunction · 0.85
codepointFunction · 0.85
byteoffsetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected