MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / fieldargs

Function fieldargs

third-party/lua-5.2.4/src/lbitlib.c:155–164  ·  view source on GitHub ↗

** get field and width arguments for field-manipulation functions, ** checking whether they are valid. ** ('luaL_error' called without 'return' to avoid later warnings about ** 'width' being used uninitialized.) */

Source from the content-addressed store, hash-verified

153** 'width' being used uninitialized.)
154*/
155static int fieldargs (lua_State *L, int farg, int *width) {
156 int f = luaL_checkint(L, farg);
157 int w = luaL_optint(L, farg + 1, 1);
158 luaL_argcheck(L, 0 <= f, farg, "field cannot be negative");
159 luaL_argcheck(L, 0 < w, farg + 1, "width must be positive");
160 if (f + w > LUA_NBITS)
161 luaL_error(L, "trying to access non-existent bits");
162 *width = w;
163 return f;
164}
165
166
167static int b_extract (lua_State *L) {

Callers 2

b_extractFunction · 0.70
b_replaceFunction · 0.70

Calls 1

luaL_errorFunction · 0.70

Tested by

no test coverage detected