#pragma once

#include <stdint.h>

#ifdef __linux__
#include <sys/types.h>
#endif

// ::SharedTypes::Declarations::Header::

typedef struct Arena Arena;

// ::SharedTypes::Attributes::Header::

#if COMPILER_MSVC || (COMPILER_CLANG && _WIN32)
# pragma section(".rdata$", read)
# define read_only __declspec(allocate(".rdata$"))
#elif (COMPILER_CLANG && __linux__)
# define read_only __attribute__((section(".rodata")))
#elif (COMPILER_GCC && __linux__)
# define read_only
#else
# error read_only not implemented for compiler/target
#endif

// ::SharedTypes::Types::Header::

typedef int8_t i8;
typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;

typedef char c8;

typedef intptr_t intptr;
typedef uintptr_t uintptr;

typedef float f32;
typedef double f64;

typedef uint8_t b8;
typedef uint32_t b32;

typedef void * rawptr;

typedef struct String8
{
	u8  *value;
	u64 len;
} String8;

#ifdef __linux__

typedef ssize_t isize;
typedef size_t usize;

#elif _WIN32

#if defined ( _WIN64 )

typedef int64_t isize;
typedef uint64_t usize;

#elif defined ( _WIN32 )

typedef int32_t isize;
typedef uint32_t usize;

#endif

#else // unix

#endif

typedef union
{
	struct { u32 upper, lower; };
	u64 full;
} U64Split;

typedef union
{
	struct { f32 r, g; };
	struct { f32 x, y; };
} Vec2;

typedef union
{
	struct { f32 x, y, z; };
	struct { f32 r, g, b; };
} Vec3;

typedef union
{
	struct { f32 x, y, z, w; };
	struct { f32 r, g, b, a; };
} Vec4;

typedef union
{
	struct { u16 x, y; };
	struct { u16 r, g; };
	struct { u16 w, h; };
} u16Vec2;

typedef union
{
	struct { i32 x, y; };
	struct { i32 r, g; };
} iVec2;

typedef union
{
	struct { i32 x, y, z; };
	struct { i32 r, g, b; };
} iVec3;

typedef union
{
	struct { i32 x, y, z, w; };
	struct { i32 r, g, b, a; };
} iVec4;

typedef union
{
	struct { i16 x, y; };
	struct { i16 r, g; };
	struct { i16 w, h; };
} i16Vec2;

typedef f32 Mat2[4];
typedef f32 Mat3[9];
typedef f32 Mat4[16];

typedef f64 dMat2[4];
typedef f64 dMat3[9];
typedef f64 dMat4[16];

