MCPcopy Create free account
hub / github.com/TASEmulators/fceux / PushNils

Function PushNils

src/lua-engine.cpp:866–883  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

864#define BITMATCH(x,y) (((x) & (y)) == (y))
865
866static void PushNils(std::vector<unsigned char>& output, int& nilcount)
867{
868 int count = nilcount;
869 nilcount = 0;
870
871 static const int minNilsWorthEncoding = 6; // because a LUAEXT_TNILS entry is 5 bytes
872
873 if(count < minNilsWorthEncoding)
874 {
875 for(int i = 0; i < count; i++)
876 output.push_back(LUA_TNIL);
877 }
878 else
879 {
880 output.push_back(LUAEXT_TNILS);
881 PushBinaryItem<uint32>(count, output);
882 }
883}
884
885static std::vector<const void*> s_tableAddressStack; // prevents infinite recursion of a table within a table (when cycle is found, print something like table:parent)
886static std::vector<const void*> s_metacallStack; // prevents infinite recursion if something's __tostring returns another table that contains that something (when cycle is found, print the inner result without using __tostring)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected