LIEF: Library to Instrument Executable Formats
Version 1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
lief-install
x86_64
static
include
LIEF
range.hpp
Go to the documentation of this file.
1
/* Copyright 2024 - 2026 R. Thomas
2
*
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at
6
*
7
* http://www.apache.org/licenses/LICENSE-2.0
8
*
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
14
*/
15
#ifndef LIEF_RANGE_H
16
#define LIEF_RANGE_H
17
#include <cstdint>
18
#include <ostream>
19
20
#include "
LIEF/visibility.h
"
21
22
namespace
LIEF
{
23
struct
range_t
{
24
uint64_t
low
= 0;
25
uint64_t
high
= 0;
26
27
bool
contains
(uint64_t value,
bool
strict =
true
)
const
{
28
if
(strict) {
29
return
low
<= value && value <
high
;
30
}
31
return
low
<= value && value <=
high
;
32
}
33
34
uint64_t
size
()
const
{
35
return
high
-
low
;
36
}
37
38
friend
bool
operator==
(
const
range_t
& lhs,
const
range_t
& rhs) {
39
return
lhs.
high
== rhs.
high
&& lhs.
low
== rhs.
low
;
40
}
41
42
friend
bool
operator!=
(
const
range_t
& lhs,
const
range_t
& rhs) {
43
return
!(lhs == rhs);
44
}
45
46
friend
LIEF_API
47
std::ostream&
operator<<
(std::ostream& os,
const
range_t
& range);
48
};
49
50
}
51
#endif
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:40
LIEF::range_t
Definition
range.hpp:23
LIEF::range_t::operator<<
friend std::ostream & operator<<(std::ostream &os, const range_t &range)
LIEF::range_t::size
uint64_t size() const
Definition
range.hpp:34
LIEF::range_t::low
uint64_t low
Definition
range.hpp:24
LIEF::range_t::high
uint64_t high
Definition
range.hpp:25
LIEF::range_t::operator==
friend bool operator==(const range_t &lhs, const range_t &rhs)
Definition
range.hpp:38
LIEF::range_t::contains
bool contains(uint64_t value, bool strict=true) const
Definition
range.hpp:27
LIEF::range_t::operator!=
friend bool operator!=(const range_t &lhs, const range_t &rhs)
Definition
range.hpp:42
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:41
Generated by
1.17.0