General Purpose library for Freestanding C++ and POSIX systems
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

59 行
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 memory_module{
  20. #ifdef GP_TESTS
  21. using default_allocator = static_mapper;
  22. #else
  23. using default_allocator = gp::c_allocator;
  24. #endif
  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. };