This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char buffer[2048]; // our packet buffer | |
// | |
// say we have the following variables that we need to pack into our packet. | |
// | |
std::uint16_t ptype = 101u; | |
bool success = true; | |
char str[] "hello world."; | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum CollectorStatus { Idle, Working } | |
class Analyst | |
{ | |
private: | |
int m_handle; | |
Status m_status; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char buf[1000]; | |
recev(buf, 1000); // buf is filled magically. | |
char * p = buf; | |
uint16_t ptype = *(uint16_t*)(p); | |
struct AResponse | |
{ | |
uint16_t ptype; | |
bool is_successful; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef SSVU_FASTFUNC | |
#define SSVU_FASTFUNC | |
#include <cstring> | |
#include <type_traits> | |
#include <cassert> | |
#include <cstddef> | |
#include <memory> | |
#include <new> | |
#include <utility> |