29#ifndef NOMLIB_STDINT_TYPES_HPP
30#define NOMLIB_STDINT_TYPES_HPP
35#include "nomlib/platforms.hpp"
50#elif defined(__llvm__) && defined(__clang__)
51 #include <sys/types.h>
53#elif defined(_MSC_VER)
64#if defined( NOM_PLATFORM_WINDOWS )
71 #if defined( NOM_COMPILER_FEATURE_NULLPTR )
91typedef uint16_t uint16;
97typedef uint32_t uint32;
103typedef double real64;
109#if defined( NOM_COMPILER_MSVCPP ) && defined( NOM_PLATFORM_ARCH_X86 )
110 typedef signed __int64 int64;
111 typedef unsigned __int64 uint64;
113 typedef int64_t int64;
114 typedef uint64_t uint64;
120typedef unsigned char uchar;
124typedef signed int sint;
127typedef unsigned int uint;
129typedef std::size_t size_type;
131typedef intptr_t* int_ptr;
132typedef uintptr_t* uint_ptr;
136typedef sint* sint_ptr;
138typedef int32_t* int32_ptr;
139typedef uint32_t* uint32_ptr;
141typedef void* void_ptr;
143typedef unsigned long ulong;
149const char NOM_CHAR_MIN = std::numeric_limits<char>::lowest();
150const char NOM_CHAR_MAX = std::numeric_limits<char>::max();
151const uchar NOM_UCHAR_MIN = std::numeric_limits<uchar>::lowest();
152const uchar NOM_UCHAR_MAX = std::numeric_limits<uchar>::max();
154const int8 NOM_INT8_MIN = std::numeric_limits<int8>::lowest();
155const int8 NOM_INT8_MAX = std::numeric_limits<int8>::max();
156const uint8 NOM_UINT8_MIN = std::numeric_limits<uint8>::lowest();
157const uint8 NOM_UINT8_MAX = std::numeric_limits<uint8>::max();
159const int16 NOM_INT16_MIN = std::numeric_limits<int16>::lowest();
160const int16 NOM_INT16_MAX = std::numeric_limits<int16>::max();
161const uint16 NOM_UINT16_MIN = std::numeric_limits<uint16>::lowest();
162const uint16 NOM_UINT16_MAX = std::numeric_limits<uint16>::max();
164const int NOM_INT_MIN = std::numeric_limits<int>::lowest();
165const int NOM_INT_MAX = std::numeric_limits<int>::max();
166const uint NOM_UINT_MIN = std::numeric_limits<uint>::lowest();
167const uint NOM_UINT_MAX = std::numeric_limits<uint>::max();
169const int32 NOM_INT32_MIN = std::numeric_limits<int32>::lowest();
170const int32 NOM_INT32_MAX = std::numeric_limits<int32>::max();
171const uint32 NOM_UINT32_MIN = std::numeric_limits<uint32>::lowest();
172const uint32 NOM_UINT32_MAX = std::numeric_limits<uint32>::max();
174const int64 NOM_INT64_MIN = std::numeric_limits<int64>::lowest();
175const int64 NOM_INT64_MAX = std::numeric_limits<int64>::max();
176const uint64 NOM_UINT64_MIN = std::numeric_limits<uint64>::lowest();
177const uint64 NOM_UINT64_MAX = std::numeric_limits<uint64>::max();
179const size_type NOM_SIZE_TYPE_MIN = std::numeric_limits<size_type>::lowest();
180const size_type NOM_SIZE_TYPE_MAX = std::numeric_limits<size_type>::max();
182const real32 NOM_REAL32_MIN = std::numeric_limits<real32>::lowest();
183const real32 NOM_REAL32_MAX = std::numeric_limits<real32>::max();
185const real64 NOM_REAL64_MIN = std::numeric_limits<real64>::lowest();
186const real64 NOM_REAL64_MAX = std::numeric_limits<real64>::max();
189static const int npos = -1;
194static const int DEFAULT_FONT_SIZE = 12;
201enum Alignment: uint32
209 X_MASK = ( X_LEFT | X_CENTER | X_RIGHT ),
216 Y_MASK = ( Y_TOP | Y_CENTER | Y_BOTTOM )
227 TopLeft = Y_TOP | X_LEFT,
228 TopCenter = Y_TOP | X_CENTER,
229 TopRight = Y_TOP | X_RIGHT,
231 MiddleLeft = Y_CENTER | X_LEFT,
232 MiddleCenter = Y_CENTER | X_CENTER,
233 MiddleRight = Y_CENTER | X_RIGHT,
235 BottomLeft = Y_BOTTOM | X_LEFT,
236 BottomCenter = Y_BOTTOM | X_CENTER,
237 BottomRight = Y_BOTTOM | X_RIGHT
240static_assert(
sizeof(nom::uint8) == 1,
"nom::uint8");
241static_assert(
sizeof(nom::int8) == 1,
"nom::int8");
243static const nom::size_type NOM_BYTE =
sizeof(uint8);
246nom::size_type kilobyte(nom::size_type bytes)
248 nom::size_type result = (bytes * NOM_BYTE);
254nom::size_type megabyte(nom::size_type bytes)
256 nom::size_type result = ( kilobyte(bytes) * NOM_BYTE);
262nom::size_type gigabyte(nom::size_type bytes)
264 nom::size_type result = ( megabyte(bytes) * NOM_BYTE );
270nom::size_type terabyte(nom::size_type bytes)
272 nom::size_type result = ( gigabyte(bytes) * NOM_BYTE );
280static_assert (
sizeof ( nom::uint16 ) == 2,
"nom::uint16" );
281static_assert (
sizeof ( nom::int16 ) == 2,
"nom::int16" );
283static_assert (
sizeof ( nom::uint32 ) == 4,
"nom::uint32" );
284static_assert (
sizeof ( nom::int32 ) == 4,
"nom::int32" );
286static_assert (
sizeof ( nom::uint64 ) == 8,
"nom::uint64" );
287static_assert (
sizeof ( nom::int64 ) == 8,
"nom::int64" );
289static_assert (
sizeof ( nom::real32 ) == 4,
"nom::real32" );
290static_assert (
sizeof ( nom::real64 ) == 8,
"nom::real64" );
292static_assert (
sizeof ( nom::uchar ) == 1,
"nom::uchar" );
295#if defined(NOM_PLATFORM_ARCH_X86_64)
296 #if defined(__WIN32__) || defined(_WIN32)
297 static_assert(
sizeof(nom::ulong) == 4,
"nom::ulong");
299 static_assert(
sizeof(nom::ulong) == 8,
"nom::ulong");
301 static_assert(
sizeof ( nom::size_type ) == 8,
"nom::size_type" );
302 static_assert(
sizeof(nom::int_ptr) == 8,
"nom::int_ptr" );
303 static_assert(
sizeof(nom::uint_ptr) == 8,
"nom::uint_ptr" );
304 static_assert(
sizeof ( nom::int32_ptr ) == (8),
"nom::int32_ptr" );
305 static_assert(
sizeof ( nom::uint32_ptr ) == (8),
"nom::uint32_ptr" );
307 static_assert(
sizeof(nom::int_ptr) == 4,
"nom::int_ptr" );
308 static_assert(
sizeof(nom::uint_ptr) == 4,
"nom::uint_ptr" );
309 static_assert(
sizeof( nom::int32_ptr ) == (
sizeof( long ) ),
"nom::int32_ptr" );
310 static_assert(
sizeof( nom::uint32_ptr ) == (
sizeof( nom::ulong ) ),
"nom::uint32_ptr" );
315const nom::sint NOM_EXIT_FAILURE = 1;
316const nom::sint NOM_EXIT_SUCCESS = 0;
319const nom::sint SDL_SUCCESS = 0;
322#define NOM_KILOBYTES(bytes) kilobyte(bytes)
323#define NOM_MEGABYTES(bytes) megabyte(bytes)
324#define NOM_GIGABYTES(bytes) gigabyte(bytes)
325#define NOM_TERABYTES(bytes) terabytes(bytes)
329#define NOM_EVENT_QUEUE_STATISTICS "NOM_EVENT_QUEUE_STATISTICS"