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

70 рядки
1.8 KiB

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