|
|
#pragma once
#ifndef ULE_TYPES_H
#define ULE_TYPES_H
#include <stddef.h> // size_t
#define null 0
#ifndef ULE_TYPES_H_FTAG
#ifdef ULE_CONFIG_OPTION_FTAG
#define ULE_TYPES_H_FTAG ULE_CONFIG_OPTION_FTAG
#else
#define ULE_TYPES_H_FTAG
#endif
#endif
// The restrict declspec is used on functions that return unaliased pointers. This keyword is used for the C-Runtime Library implementation of malloc since it will never return a pointer value that is already in use in the current program (unless you are doing something illegal, such as using memory after it has been freed).
// https://learn.microsoft.com/en-us/cpp/cpp/restrict?view=msvc-170
// @NOTE(gingerbill posted this):
//#if !defined(restrict)
// #if defined(_MSC_VER)
// #define shard_restrict __restrict
// #elif defined(__STDC_VERSION__)
// #define shard_restrict restrict
// #else
// #define shard_restrict
// #endif
//#endif
// The noalias declspec is also applied only to functions, and indicates that the function is a semi-pure function. A semi-pure function is one that references or modifies only locals, arguments, and first-level indirections of arguments. This declspec is a promise to the compiler, and if the function references globals or second-level indirections of pointer arguments then the compiler may generate code that breaks the application.
// https://learn.microsoft.com/en-us/cpp/cpp/noalias?view=msvc-170
// char
// unsigned char
#include <stdint.h>
typedef uint64_t u64; typedef uint32_t u32; typedef uint16_t u16; typedef uint8_t u8;
typedef int64_t s64; typedef int32_t s32; typedef int16_t s16; typedef int8_t s8;
//typedef size_t size_t;
// we use the standard C names for IEEE-754 binary64 and binary32 (double, float). we don't use 'extended'.
//typedef float float;
//typedef double double;
//typedef long double extended;
// if we're using the glm vector/matrix types, or other types, define them here
#ifdef ULE_CONFIG_OPTION_USE_GLM
// force high precision for everything
#define GLM_PRECISION_HIGHP_FLOAT
#define GLM_PRECISION_HIGHP_DOUBLE
#define GLM_PRECISION_HIGHP_INT
#define GLM_PRECISION_HIGHP_UINT
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#endif
typedef enum TypeEnum { TypeEnum_bool,
TypeEnum_char, TypeEnum_uchar,
TypeEnum_u8, TypeEnum_u16, TypeEnum_u32, TypeEnum_u64, TypeEnum_s8, TypeEnum_s16, TypeEnum_s32, TypeEnum_s64,
#ifndef _WIN32
TypeEnum_size_t, #endif
TypeEnum_float, TypeEnum_double,
#ifdef _USING_GLM_TYPES__
TypeEnum_vec2, TypeEnum_vec3, TypeEnum_vec4,
TypeEnum_mat2, TypeEnum_mat3, TypeEnum_mat4, #endif
} TypeEnum;
#endif
|