General Purpose library for Freestanding C++ and POSIX systems
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 rivejä
1.4 KiB

4 vuotta sitten
4 vuotta sitten
4 vuotta sitten
  1. #pragma once
  2. #include <type_traits>
  3. #include <cstddef>
  4. #include <cstdint>
  5. #include <cstdlib>
  6. #ifdef GP_TESTS
  7. class static_mapper;
  8. #else
  9. namespace gp {
  10. class c_allocator;
  11. }
  12. #endif
  13. namespace gp_config{
  14. namespace rendering {
  15. using default_type = float;
  16. constexpr default_type epsilon = 0.001;
  17. #define GP_CONFIG__RENDERING__COLOR_T vec4
  18. }
  19. namespace limits {
  20. constexpr size_t max_processes = 4096;
  21. constexpr size_t max_fd_per_process = 128;
  22. constexpr size_t process_stack = 1024; // times 16
  23. }
  24. namespace memory_module{
  25. #ifdef GP_TESTS
  26. using default_allocator = static_mapper;
  27. #else
  28. using default_allocator = gp::c_allocator;
  29. #endif
  30. constexpr bool is_ok = true;
  31. }
  32. typedef uint32_t file_descriptor_t;
  33. constexpr bool has_exceptions = true;
  34. constexpr bool has_buffer_bounds = true;
  35. // Value of 8 is considered not cryptographically secure
  36. // Value of 12 offers a good compromise of performance and robustness
  37. // Value of 20 offers maximum robustness
  38. constexpr size_t arc4random_strength = 20;
  39. struct assert_failure{
  40. assert_failure(const char* reason)
  41. : what_str{reason}
  42. {}
  43. const char* what_str;
  44. const char* what() {return what_str;}
  45. };
  46. constexpr size_t assert_buffer_size = 0;
  47. constexpr auto assertion = [](bool pred, const char* reason) -> void{
  48. if constexpr (has_exceptions)
  49. if(!pred) throw assert_failure(reason);
  50. };
  51. }
  52. enum class gp_errorcodes : int {
  53. infinite_skipstone = 3000
  54. };