General Purpose library for Freestanding C++ and POSIX systems
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 

61 строки
1.3 KiB

#pragma once
#include <type_traits>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#ifdef GP_TESTS
class static_mapper;
#else
namespace gp {
class c_allocator;
}
#endif
namespace gp_config{
namespace rendering {
using default_type = float;
constexpr default_type epsilon = 0.001;
#define GP_CONFIG__RENDERING__COLOR_T vec4
}
namespace memory_module{
#ifdef GP_TESTS
using default_allocator = static_mapper;
#else
using default_allocator = gp::c_allocator;
#endif
constexpr bool is_ok = true;
}
typedef uint32_t file_descriptor_t;
constexpr bool has_exceptions = true;
constexpr bool has_buffer_bounds = true;
// Value of 8 is considered not cryptographically secure
// Value of 12 offers a good compromise of performance and robustness
// Value of 20 offers maximum robustness
constexpr size_t arc4random_strength = 20;
struct assert_failure{
assert_failure(const char* reason)
: what_str{reason}
{}
const char* what_str;
const char* what() {return what_str;}
};
constexpr size_t assert_buffer_size = 0;
constexpr auto assertion = [](bool pred, const char* reason) -> void{
if constexpr (has_exceptions)
if(!pred) throw assert_failure(reason);
};
}
enum class gp_errorcodes : int {
infinite_skipstone = 3000
};