| 45 | } |
| 46 | |
| 47 | uint32_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 | /** |
no outgoing calls
no test coverage detected