General code base needs.
This commit is contained in:
parent
e7f7f3e321
commit
367057174d
@ -1,10 +1,12 @@
|
|||||||
#ifndef BASE_CORE_H
|
#ifndef BASE_CORE_H
|
||||||
#define BASE_CORE_H
|
#define BASE_CORE_H
|
||||||
|
|
||||||
#define global static
|
// Foreigns
|
||||||
#define local static
|
#include <string.h>
|
||||||
#define internal static
|
|
||||||
|
|
||||||
|
#define global static
|
||||||
|
#define local static
|
||||||
|
#define internal static
|
||||||
|
|
||||||
// Base Types
|
// Base Types
|
||||||
typedef uint8_t u8;
|
typedef uint8_t u8;
|
||||||
@ -25,5 +27,27 @@ typedef s64 b64;
|
|||||||
typedef float f32;
|
typedef float f32;
|
||||||
typedef double f64;
|
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
|
#endif // BASE_CORE_H
|
||||||
|
@ -10,5 +10,4 @@
|
|||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
|
||||||
#endif // BASE_INC_H
|
#endif // BASE_INC_H
|
||||||
|
Loading…
Reference in New Issue
Block a user