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

Function getaint

source/src/protocol.cpp:51–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49void putaint(vector<uchar> &p, int n) { putaint_(p, n); }
50
51int getaint(ucharbuf &p)
52{
53 int c = ((char)p.get()) + 125;
54 if(c==-128) { int n = p.get(); n |= p.get()<<8; n -= 256; DEBUGVAR(n); return n; }
55 else if(c==-127) { int n = p.get(); n |= p.get()<<8; n |= p.get()<<16; n |= (p.get()<<24); DEBUGVAR(n); return n; }
56 else
57 {
58 DEBUGVAR(c);
59 return c;
60 }
61}
62
63// much smaller encoding for unsigned integers up to 28 bits, but can handle signed
64template<class T>

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected