General code base needs.

This commit is contained in:
Tijani Lawal 2024-08-05 01:33:43 -05:00
parent e7f7f3e321
commit 367057174d
2 changed files with 27 additions and 4 deletions

View File

@ -1,10 +1,12 @@
#ifndef BASE_CORE_H
#define BASE_CORE_H
#define global static
#define local static
#define internal static
// Foreigns
#include <string.h>
#define global static
#define local static
#define internal static
// Base Types
typedef uint8_t u8;
@ -25,5 +27,27 @@ typedef s64 b64;
typedef float f32;
typedef double f64;
// Units
#define KB(n) (((u64)(n)) << 10)
#define MB(n) (((u64)(n)) << 20)
#define GB(n) (((u64)(n)) << 30)
#define TB(n) (((u64)(n)) << 40)
#define Thousand(n) ((n) * 1000)
#define Million(n) ((n) * 1000000)
#define Billion(n) ((n) * 1000000000)
// Memory operations
#define MemoryZero(dest, count) memset((dest), 0, (count))
// Max, Min
#define Max(A, B) (((A) > (B)) ? (A) : (B))
#define Min(A, B) (((A) < (B)) ? (A) : (B))
// Type Alignment
#if COMPILER_MSVC
#define Align_Of(T) __alignof(T)
#else
#error Align_Of not defined for this compiler.
#endif
#endif // BASE_CORE_H

View File

@ -10,5 +10,4 @@
// clang-format on
#endif // BASE_INC_H