omi-eikyo/src/m_types.h

50 lines
1.3 KiB
C

// Copyright © 2017 Project Golan, all rights reserved.
#ifndef m_types_h
#define m_types_h
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#if __GDCC__
#include <stdfix.h>
#undef fixed
#endif
#define M_countof(a) (sizeof(a) / sizeof(*a))
// Types ---------------------------------------------------------------------|
typedef size_t msize; // Machine Size
typedef ptrdiff_t mpdif; // Machine Pointer Difference
typedef uint8_t mbyte; // Machine Byte
typedef uint16_t hword; // Half Word
typedef uint32_t mword; // Machine Word
typedef uint64_t dword; // Double Word
#if __GDCC__
typedef uint96_t tword; // Triple Word
#endif
typedef int8_t chara; // Character
typedef int16_t int16; // Integer (16 bits)
typedef int32_t integ; // Integer (Machine)
typedef int64_t int64; // Integer (64 bits)
#if __GDCC__
typedef int96_t int96; // Integer (96 bits)
#endif
#if __GDCC__
typedef short accum fixed; // Fixed Point
typedef accum lfxpt; // Long Fixed Point
typedef unsigned long fract ulfra; // Unsigned Long Fractional
typedef long fract lfrac; // Long Fractional
#else
typedef float fixed;
typedef double lfxpt;
#endif
typedef unsigned M_texid; // Texture ID
typedef unsigned M_shdid; // Shader ID
typedef unsigned M_fntid; // Font ID
#endif