MCPcopy Create free account
hub / github.com/assaultcube/AC / getint

Function getint

source/src/protocol.cpp:25–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23void putint(vector<uchar> &p, int n) { putint_(p, n); }
24
25int getint(ucharbuf &p)
26{
27 int c = (char)p.get();
28 if(c==-128) { int n = p.get(); n |= char(p.get())<<8; DEBUGVAR(n); return n; }
29 else if(c==-127) { int n = p.get(); n |= p.get()<<8; n |= p.get()<<16; n |= (p.get()<<24); DEBUGVAR(n); return n; }
30 else
31 {
32 DEBUGVAR(c);
33 return c;
34 }
35}
36
37// special encoding for asymmetric small integers: -1..252 go into one byte, -256..65279 go into three bytes and any other int goes into five bytes
38// (the network encoding is compatible with basic getint)

Callers 12

parsepositionsFunction · 0.85
parsemessagesFunction · 0.85
loopiFunction · 0.85
receivefileFunction · 0.85
getstringFunction · 0.85
checkpingsFunction · 0.85
servermsFunction · 0.85
processFunction · 0.85
loopkFunction · 0.85
extping_serverinfoFunction · 0.85
getvantagepointFunction · 0.85
restoreeditundoFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected