MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / controloptions

Function controloptions

deps/lua/src/lua_struct.c:148–166  ·  view source on GitHub ↗

** options to control endianess and alignment */

Source from the content-addressed store, hash-verified

146** options to control endianess and alignment
147*/
148static void controloptions (lua_State *L, int opt, const char **fmt,
149 Header *h) {
150 switch (opt) {
151 case ' ': return; /* ignore white spaces */
152 case '>': h->endian = BIG; return;
153 case '<': h->endian = LITTLE; return;
154 case '!': {
155 int a = getnum(L, fmt, MAXALIGN);
156 if (!isp2(a))
157 luaL_error(L, "alignment %d is not a power of 2", a);
158 h->align = a;
159 return;
160 }
161 default: {
162 const char *msg = lua_pushfstring(L, "invalid format option '%c'", opt);
163 luaL_argerror(L, 1, msg);
164 }
165 }
166}
167
168
169static void putinteger (lua_State *L, luaL_Buffer *b, int arg, int endian,

Callers 3

b_packFunction · 0.85
b_unpackFunction · 0.85
b_sizeFunction · 0.85

Calls 4

getnumFunction · 0.85
luaL_errorFunction · 0.85
lua_pushfstringFunction · 0.85
luaL_argerrorFunction · 0.85

Tested by

no test coverage detected