29#ifndef NOMLIB_STDINT_TYPES_HPP
30#define NOMLIB_STDINT_TYPES_HPP
35#include "nomlib/platforms.hpp"
50#elif defined(__llvm__)
51 #include <sys/types.h>
61#if defined( NOM_PLATFORM_WINDOWS )
68 #if defined( NOM_COMPILER_FEATURE_NULLPTR )
88typedef uint16_t uint16;
94typedef uint32_t uint32;
100typedef double real64;
106#if defined( NOM_COMPILER_MSVCPP ) && defined( NOM_PLATFORM_ARCH_X86 )
107 typedef signed __int64 int64;
108 typedef unsigned __int64 uint64;
110 typedef int64_t int64;
111 typedef uint64_t uint64;
117typedef unsigned char uchar;
121typedef signed int sint;
124typedef unsigned int uint;
126typedef std::size_t size_type;
128typedef intptr_t* int_ptr;
129typedef uintptr_t* uint_ptr;
133typedef sint* sint_ptr;
135typedef int32_t* int32_ptr;
136typedef uint32_t* uint32_ptr;
138typedef void* void_ptr;
140typedef unsigned long ulong;
146const char NOM_CHAR_MIN = std::numeric_limits<char>::lowest();
147const char NOM_CHAR_MAX = std::numeric_limits<char>::max();
148const uchar NOM_UCHAR_MIN = std::numeric_limits<uchar>::lowest();
149const uchar NOM_UCHAR_MAX = std::numeric_limits<uchar>::max();
151const int8 NOM_INT8_MIN = std::numeric_limits<int8>::lowest();
152const int8 NOM_INT8_MAX = std::numeric_limits<int8>::max();
153const uint8 NOM_UINT8_MIN = std::numeric_limits<uint8>::lowest();
154const uint8 NOM_UINT8_MAX = std::numeric_limits<uint8>::max();
156const int16 NOM_INT16_MIN = std::numeric_limits<int16>::lowest();
157const int16 NOM_INT16_MAX = std::numeric_limits<int16>::max();
158const uint16 NOM_UINT16_MIN = std::numeric_limits<uint16>::lowest();
159const uint16 NOM_UINT16_MAX = std::numeric_limits<uint16>::max();
161const int NOM_INT_MIN = std::numeric_limits<int>::lowest();
162const int NOM_INT_MAX = std::numeric_limits<int>::max();
163const uint NOM_UINT_MIN = std::numeric_limits<uint>::lowest();
164const uint NOM_UINT_MAX = std::numeric_limits<uint>::max();
166const int32 NOM_INT32_MIN = std::numeric_limits<int32>::lowest();
167const int32 NOM_INT32_MAX = std::numeric_limits<int32>::max();
168const uint32 NOM_UINT32_MIN = std::numeric_limits<uint32>::lowest();
169const uint32 NOM_UINT32_MAX = std::numeric_limits<uint32>::max();
171const int64 NOM_INT64_MIN = std::numeric_limits<int64>::lowest();
172const int64 NOM_INT64_MAX = std::numeric_limits<int64>::max();
173const uint64 NOM_UINT64_MIN = std::numeric_limits<uint64>::lowest();
174const uint64 NOM_UINT64_MAX = std::numeric_limits<uint64>::max();
176const size_type NOM_SIZE_TYPE_MIN = std::numeric_limits<size_type>::lowest();
177const size_type NOM_SIZE_TYPE_MAX = std::numeric_limits<size_type>::max();
179const real32 NOM_REAL32_MIN = std::numeric_limits<real32>::lowest();
180const real32 NOM_REAL32_MAX = std::numeric_limits<real32>::max();
182const real64 NOM_REAL64_MIN = std::numeric_limits<real64>::lowest();
183const real64 NOM_REAL64_MAX = std::numeric_limits<real64>::max();
186static const int npos = -1;
191static const int DEFAULT_FONT_SIZE = 12;
198enum Alignment: uint32
206 X_MASK = ( X_LEFT | X_CENTER | X_RIGHT ),
213 Y_MASK = ( Y_TOP | Y_CENTER | Y_BOTTOM )
224 TopLeft = Y_TOP | X_LEFT,
225 TopCenter = Y_TOP | X_CENTER,
226 TopRight = Y_TOP | X_RIGHT,
228 MiddleLeft = Y_CENTER | X_LEFT,
229 MiddleCenter = Y_CENTER | X_CENTER,
230 MiddleRight = Y_CENTER | X_RIGHT,
232 BottomLeft = Y_BOTTOM | X_LEFT,
233 BottomCenter = Y_BOTTOM | X_CENTER,
234 BottomRight = Y_BOTTOM | X_RIGHT
237static_assert(
sizeof(nom::uint8) == 1,
"nom::uint8");
238static_assert(
sizeof(nom::int8) == 1,
"nom::int8");
240const nom::size_type NOM_BYTE =
sizeof(uint8);
243nom::size_type kilobyte(nom::size_type bytes)
245 nom::size_type result = (bytes * NOM_BYTE);
251nom::size_type megabyte(nom::size_type bytes)
253 nom::size_type result = ( kilobyte(bytes) * NOM_BYTE);
259nom::size_type gigabyte(nom::size_type bytes)
261 nom::size_type result = ( megabyte(bytes) * NOM_BYTE );
267nom::size_type terabyte(nom::size_type bytes)
269 nom::size_type result = ( gigabyte(bytes) * NOM_BYTE );
277static_assert (
sizeof ( nom::uint16 ) == 2,
"nom::uint16" );
278static_assert (
sizeof ( nom::int16 ) == 2,
"nom::int16" );
280static_assert (
sizeof ( nom::uint32 ) == 4,
"nom::uint32" );
281static_assert (
sizeof ( nom::int32 ) == 4,
"nom::int32" );
283static_assert (
sizeof ( nom::uint64 ) == 8,
"nom::uint64" );
284static_assert (
sizeof ( nom::int64 ) == 8,
"nom::int64" );
286static_assert (
sizeof ( nom::real32 ) == 4,
"nom::real32" );
287static_assert (
sizeof ( nom::real64 ) == 8,
"nom::real64" );
289static_assert (
sizeof ( nom::uchar ) == 1,
"nom::uchar" );
293#if defined(NOM_PLATFORM_ARCH_X86_64)
294 static_assert(
sizeof ( nom::ulong ) == 8,
"nom::ulong" );
295 static_assert(
sizeof ( nom::size_type ) == 8,
"nom::size_type" );
297 static_assert(
sizeof ( nom::ulong ) == 4,
"nom::ulong" );
298 static_assert(
sizeof ( nom::size_type ) == 4,
"nom::size_type" );
302#if defined(NOM_PLATFORM_ARCH_X86_64)
303 static_assert(
sizeof(nom::int_ptr) == 8,
"nom::int_ptr" );
304 static_assert(
sizeof(nom::uint_ptr) == 8,
"nom::uint_ptr" );
305 static_assert(
sizeof ( nom::int32_ptr ) == (
sizeof(long) ),
"nom::int32_ptr" );
306 static_assert(
sizeof ( nom::uint32_ptr ) == (
sizeof(nom::ulong) ),
"nom::uint32_ptr" );
308 static_assert(
sizeof(nom::int_ptr) == 4,
"nom::int_ptr" );
309 static_assert(
sizeof(nom::uint_ptr) == 4,
"nom::uint_ptr" );
310 static_assert(
sizeof( nom::int32_ptr ) == (
sizeof( long ) ),
"nom::int32_ptr" );
311 static_assert(
sizeof( nom::uint32_ptr ) == (
sizeof( nom::ulong ) ),
"nom::uint32_ptr" );
316const nom::sint NOM_EXIT_FAILURE = 1;
317const nom::sint NOM_EXIT_SUCCESS = 0;
320const nom::sint SDL_SUCCESS = 0;
323#define NOM_KILOBYTES(bytes) kilobyte(bytes)
324#define NOM_MEGABYTES(bytes) megabyte(bytes)
325#define NOM_GIGABYTES(bytes) gigabyte(bytes)
326#define NOM_TERABYTES(bytes) terabytes(bytes)
330#define NOM_EVENT_QUEUE_STATISTICS "NOM_EVENT_QUEUE_STATISTICS"