#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 limits {
|
|
constexpr size_t max_processes = 4096;
|
|
constexpr size_t max_fd_per_process = 128;
|
|
constexpr size_t process_stack = 1024; // times 16
|
|
}
|
|
|
|
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
|
|
};
|