General Purpose library for Freestanding C++ and POSIX systems
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

60 řádky
1.3 KiB

  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. constexpr bool is_ok = true;
  26. }
  27. typedef uint32_t file_descriptor_t;
  28. constexpr bool has_exceptions = true;
  29. constexpr bool has_buffer_bounds = true;
  30. // Value of 8 is considered not cryptographically secure
  31. // Value of 12 offers a good compromise of performance and robustness
  32. // Value of 20 offers maximum robustness
  33. constexpr size_t arc4random_strength = 20;
  34. struct assert_failure{
  35. assert_failure(const char* reason)
  36. : what_str{reason}
  37. {}
  38. const char* what_str;
  39. const char* what() {return what_str;}
  40. };
  41. constexpr size_t assert_buffer_size = 0;
  42. constexpr auto assertion = [](bool pred, const char* reason) -> void{
  43. if constexpr (has_exceptions)
  44. if(!pred) throw assert_failure(reason);
  45. };
  46. }
  47. enum class gp_errorcodes : int {
  48. infinite_skipstone = 3000
  49. };