Skip to content

Instantly share code, notes, and snippets.

@yxbh
yxbh / FastFunc.hpp
Last active August 29, 2015 14:02 — forked from vittorioromeo/FastFunc.hpp
Added workarounds for Visual Studios 2013 and up. '/OPT:NOICF' linker flag required for VC++
#ifndef SSVU_FASTFUNC
#define SSVU_FASTFUNC
#include <cstring>
#include <type_traits>
#include <cassert>
#include <cstddef>
#include <memory>
#include <new>
#include <utility>
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;
enum CollectorStatus { Idle, Working }
class Analyst
{
private:
int m_handle;
Status m_status;
}
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.";
//