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

Function b_replace

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

Source from the content-addressed store, hash-verified

175
176
177static int b_replace (lua_State *L) {
178 int w;
179 b_uint r = luaL_checkunsigned(L, 1);
180 b_uint v = luaL_checkunsigned(L, 2);
181 int f = fieldargs(L, 3, &w);
182 int m = mask(w);
183 v &= m; /* erase bits outside given width */
184 r = (r & ~(m << f)) | (v << f);
185 lua_pushunsigned(L, r);
186 return 1;
187}
188
189
190static const luaL_Reg bitlib[] = {

Callers

nothing calls this directly

Calls 3

luaL_checkunsignedFunction · 0.85
lua_pushunsignedFunction · 0.85
fieldargsFunction · 0.70

Tested by

no test coverage detected