MinMax.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #pragma once
  2. #include "ThirdPartyHeadersBegin.h"
  3. #include <algorithm>
  4. #include "ThirdPartyHeadersEnd.h"
  5. #include "CodeContract.h"
  6. class ___2479 : public std::pair<double, double>
  7. {
  8. #define INVALID_MINMAX_MIN_VALUE (10. * ___2179)
  9. #define INVALID_MINMAX_MAX_VALUE (-10. * ___2179)
  10. public:
  11. ___2479() { invalidate(); }
  12. ___2479(double newMin, double newMax)
  13. {
  14. first = newMin;
  15. second = newMax;
  16. }
  17. explicit ___2479(double ___4298)
  18. {
  19. first = ___4298;
  20. second = first;
  21. }
  22. inline void swap(___2479 &___2888)
  23. {
  24. using std::swap;
  25. swap(first, ___2888.first);
  26. swap(second, ___2888.second);
  27. }
  28. inline double minValue(void) const { return first; }
  29. inline double maxValue(void) const { return second; }
  30. inline void ___3499(double newMin, double newMax)
  31. {
  32. REQUIRE(newMin <= newMax);
  33. first = newMin;
  34. second = newMax;
  35. }
  36. inline void ___3499(___2479 const &___2888)
  37. {
  38. first = ___2888.first;
  39. second = ___2888.second;
  40. }
  41. inline void include(double ___4298)
  42. {
  43. first = std::min(first, ___4298);
  44. second = std::max(second, ___4298);
  45. }
  46. inline void include(___2479 const &minMax)
  47. {
  48. REQUIRE(minMax.___2067());
  49. first = std::min(first, minMax.first);
  50. second = std::max(second, minMax.second);
  51. }
  52. inline bool containsValue(double ___4298) const { return (first <= ___4298 && ___4298 <= second); }
  53. inline void invalidate(void)
  54. {
  55. first = INVALID_MINMAX_MIN_VALUE;
  56. second = INVALID_MINMAX_MAX_VALUE;
  57. }
  58. inline bool ___2067(void) const
  59. {
  60. REQUIRE(*(uint64_t *)&first != 0xcdcdcdcdcdcd || *(uint64_t *)&second != 0xcdcdcdcdcdcd);
  61. bool const valid = (first <= second);
  62. ___478(IMPLICATION(!valid, first == INVALID_MINMAX_MIN_VALUE && second == INVALID_MINMAX_MAX_VALUE));
  63. return valid;
  64. }
  65. };