sanitizer_range.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //===-- sanitizer_range.h ---------------------------------------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // Contais Range and related utilities.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef SANITIZER_RANGE_H
  13. #define SANITIZER_RANGE_H
  14. #include "sanitizer_common.h"
  15. #include "sanitizer_common/sanitizer_array_ref.h"
  16. namespace __sanitizer {
  17. struct Range {
  18. uptr begin;
  19. uptr end;
  20. };
  21. inline bool operator==(const Range &lhs, const Range &rhs) {
  22. return lhs.begin == rhs.begin && lhs.end == rhs.end;
  23. }
  24. inline bool operator!=(const Range &lhs, const Range &rhs) {
  25. return !(lhs == rhs);
  26. }
  27. // Calculates intersection of two sets of regions in O(N log N) time.
  28. void Intersect(ArrayRef<Range> a, ArrayRef<Range> b,
  29. InternalMmapVectorNoCtor<Range> &output);
  30. } // namespace __sanitizer
  31. #endif // SANITIZER_RANGE_H