You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lunarium_OLD/src/core/common_defs.h

57 lines
1.7 KiB
C

/******************************************************************************
* File - common_defs.h
* Author - Joey Pollack
* Date - 2022/05/11 (y/m/d)
* Mod Date - 2022/05/11 (y/m/d)
* Description - Common definitions for the engine
******************************************************************************/
#ifndef LUNARIUM_COMMON_DEFS_H_
#define LUNARIUM_COMMON_DEFS_H_
// intrinsic type short-hands
// The idea for this was taken from the KOHI engine
// https://github.com/travisvroman/kohi
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
typedef unsigned long long u64;
typedef char i8;
typedef short i16;
typedef int i32;
typedef long long i64;
typedef float f32;
typedef double f64;
// verify the type sizes
static_assert(sizeof(u8) == 1, "Expected u8 to be 1 byte");
static_assert(sizeof(u16) == 2, "Expected u16 to be 2 bytes");
static_assert(sizeof(u32) == 4, "Expected u32 to be 4 bytes");
static_assert(sizeof(u64) == 8, "Expected u64 to be 8 bytes");
static_assert(sizeof(i8) == 1, "Expected i8 to be 1 byte");
static_assert(sizeof(i16) == 2, "Expected i16 to be 2 bytes");
static_assert(sizeof(i32) == 4, "Expected i32 to be 4 bytes");
static_assert(sizeof(i64) == 8, "Expected i64 to be 8 bytes");
static_assert(sizeof(f32) == 4, "Expected f32 to be 4 bytes");
static_assert(sizeof(f64) == 8, "Expected f64 to be 8 bytes");
typedef u64 LUUID;
// Platform detection
#if defined(_WIN32) || defined(_WIN64)
#define LPLATFORM_WINDOWS
#elif defined(__linux__) || defined(__gnu_linux__)
#define LPLATFORM_LINUX
#else
#error "Unsupported platform. Must build on windows or linux"
#endif
#endif // LUNARIUM_COMMON_DEFS_H_