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

Function optsize

deps/lua/src/lua_struct.c:111–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109
110
111static size_t optsize (lua_State *L, char opt, const char **fmt) {
112 switch (opt) {
113 case 'B': case 'b': return sizeof(char);
114 case 'H': case 'h': return sizeof(short);
115 case 'L': case 'l': return sizeof(long);
116 case 'T': return sizeof(size_t);
117 case 'f': return sizeof(float);
118 case 'd': return sizeof(double);
119 case 'x': return 1;
120 case 'c': return getnum(L, fmt, 1);
121 case 'i': case 'I': {
122 int sz = getnum(L, fmt, sizeof(int));
123 if (sz > MAXINTSIZE)
124 luaL_error(L, "integral size %d is larger than limit of %d",
125 sz, MAXINTSIZE);
126 return sz;
127 }
128 default: return 0; /* other cases do not need alignment */
129 }
130}
131
132
133/*

Callers 3

b_packFunction · 0.85
b_unpackFunction · 0.85
b_sizeFunction · 0.85

Calls 2

getnumFunction · 0.85
luaL_errorFunction · 0.85

Tested by

no test coverage detected