MCPcopy Create free account
hub / github.com/dermesser/libsocket / decode_uint32

Function decode_uint32

C++/framing.cpp:47–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47uint32_t decode_uint32(const char* src) {
48 uint32_t result = 0;
49 // We store unsigned numbers in signed chars; convert, otherwise the MSB
50 // being set would be interpreted as sign and taken over to uint32_t's MSB.
51 const unsigned char* src_ = (const unsigned char*)src;
52
53 for (int i = 3; i >= 0; i--) {
54 result |= uint32_t(src_[i]) << (8 * (3 - i));
55 }
56
57 return result;
58}
59} // namespace libsocket
60
61/**

Callers 2

receive_headerMethod · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected