d: Merge upstream dmd, druntime 2bbf64907c, phobos b64bfbf91
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_range.h
blob7c593e171ba21d5874ad819eeed01eac03e10548
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.
11 //===----------------------------------------------------------------------===//
13 #ifndef SANITIZER_RANGE_H
14 #define SANITIZER_RANGE_H
16 #include "sanitizer_common.h"
17 #include "sanitizer_common/sanitizer_array_ref.h"
19 namespace __sanitizer {
21 struct Range {
22 uptr begin;
23 uptr end;
26 inline bool operator==(const Range &lhs, const Range &rhs) {
27 return lhs.begin == rhs.begin && lhs.end == rhs.end;
30 inline bool operator!=(const Range &lhs, const Range &rhs) {
31 return !(lhs == rhs);
34 // Calculates intersection of two sets of regions in O(N log N) time.
35 void Intersect(ArrayRef<Range> a, ArrayRef<Range> b,
36 InternalMmapVectorNoCtor<Range> &output);
38 } // namespace __sanitizer
40 #endif // SANITIZER_RANGE_H