-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCommon.h
21 lines (16 loc) · 939 Bytes
/
Common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//----------------------------------------------------------------------------------------------------------------------
// Common header (stuff that we share across files)
// Copyright (c) 2024 Samuel Gomes
//----------------------------------------------------------------------------------------------------------------------
#pragma once
#include <cstdint>
// Use these with care. Expressions passed to macros can be evaluated multiple times and wrong types can cause all kinds of bugs
#define IS_STRING_EMPTY(_s_) ((_s_) == nullptr || (_s_)[0] == 0)
#define ZERO_MEMORY(_p_, _s_) memset((_p_), 0, (_s_))
#define ZERO_VARIABLE(_v_) memset(&(_v_), 0, sizeof(_v_))
#define ZERO_OBJECT(_p_) memset((_p_), 0, sizeof(*(_p_)))
// Temporary 4k static buffer shared by various modules
static uint8_t g_TmpBuf[4096];
#define Compiler_GetDate() (__DATE__)
#define Compiler_GetTime() (__TIME__)
#define Compiler_GetFunctionName() (__func__)