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

Function main

examples++/framing.cpp:9–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#include <libsocket/framing.hpp>
8
9int main(void) {
10 char dest[4];
11 memset(dest, 0, 4);
12 uint32_t number = (1 << 30) + 123;
13 uint32_t decoded;
14
15 libsocket::encode_uint32(number, dest);
16
17 if (number != (decoded = libsocket::decode_uint32(dest))) {
18 std::cout << "Failure: " << number << " " << decoded << std::endl;
19
20 for (int i = 0; i < 4; i++) {
21 printf("%02hhx", dest[i]);
22 }
23 printf("\n");
24 printf("%x\n", decoded);
25 }
26
27 return 0;
28}

Callers

nothing calls this directly

Calls 2

encode_uint32Function · 0.85
decode_uint32Function · 0.85

Tested by

no test coverage detected