SDLU/include/Util.hpp

33 lines
785 B
C++
Raw Normal View History

2020-05-16 21:36:21 +00:00
/**
* @file Util.hpp
* @brief Basic utility macros, typedefs...
* @author Lauchmelder23
* @date 16.05.2020
*/
#pragma once
#include <cstdint>
2020-05-19 13:20:25 +00:00
#define PI 3.1415926f
2020-05-16 21:36:21 +00:00
#define IS_NULLPTR( x ) (x == nullptr)
2020-05-18 23:33:42 +00:00
#define RETURN_IF_NULLPTR( x, ... ) { if(IS_NULLPTR(x)) return __VA_ARGS__; }
#define RETURN_IF_NOT_NULLPTR( x, ... ) { if(!IS_NULLPTR(x)) return __VA_ARGS__; }
2020-05-16 21:36:21 +00:00
typedef uint8_t Uint8;
typedef int8_t Int8;
typedef uint16_t Uint16;
typedef int16_t Int16;
typedef uint32_t Uint32;
typedef int32_t Int32;
typedef uint64_t Uint64;
2021-04-23 13:08:51 +00:00
typedef int64_t Int64;
#define THROW_IF( condition, exception ) ( condition ? throw exception : false)
#define THROW_IF_NOT( condition, exception ) ( THROW_IF(!condition, exception) )
#define SDLU_BEGIN namespace sdlu {
#define SDLU_END }