syncd/common.hpp
#pragma once
#include <unistd.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#define LOG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)
#define LOG_ERRNO(fmt, ...) LOG(fmt " - %d - %d: %s", ##__VA_ARGS__, __LINE__, errno, strerror(errno))
#define INLINE inline __attribute__((always_inline))
#define UNUSED(expr) if (expr) {}
#define MIN(a, b) ((a)<(b)?(a):(b))
#define MAX(a, b) ((a)>(b)?(a):(b))
#define COLOR_RED "\x1b[31m"
#define COLOR_GREEN "\x1b[32m"
#define COLOR_YELLOW "\x1b[33m"
#define COLOR_RESET "\x1b[0m"
#define COLOR(col, str) COLOR_##col str COLOR_RESET