mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
Fix address_range start_length() constructor
Fixes an underflow when constructing start_length(0, 0).
This commit is contained in:
parent
791ec95313
commit
0db91aa56b
@ -60,21 +60,26 @@ namespace utils
|
||||
return (start1 >= start2 && end1 <= end2);
|
||||
}
|
||||
|
||||
address_range(u32 _start, u32 _end) : start(_start), end(_end) {}
|
||||
constexpr address_range(u32 _start, u32 _end) : start(_start), end(_end) {}
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
address_range() = default;
|
||||
address_range(const address_range &other) : start(other.start), end(other.end) {}
|
||||
constexpr address_range() = default;
|
||||
constexpr address_range(const address_range &other) : start(other.start), end(other.end) {}
|
||||
|
||||
static inline address_range start_length(u32 _start, u32 _length)
|
||||
static constexpr address_range start_length(u32 _start, u32 _length)
|
||||
{
|
||||
return address_range(_start, _start + (_length - 1));
|
||||
if (!_length)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
return {_start, _start + (_length - 1)};
|
||||
}
|
||||
|
||||
static inline address_range start_end(u32 _start, u32 _end)
|
||||
static constexpr address_range start_end(u32 _start, u32 _end)
|
||||
{
|
||||
return address_range(_start, _end);
|
||||
return {_start, _end};
|
||||
}
|
||||
|
||||
// Length
|
||||
|
Loading…
Reference in New Issue
Block a user