2020-11-10 15:26:38 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
2021-09-09 01:56:48 +02:00
|
|
|
#include <cstddef>
|
2020-11-10 15:26:38 +01:00
|
|
|
|
2022-03-27 00:01:28 +01:00
|
|
|
#include <hex/helpers/intrinsics.hpp>
|
|
|
|
|
2022-02-01 22:09:44 +01:00
|
|
|
constexpr static const auto ImHexApiURL = "https://api.werwolv.net/imhex";
|
2021-08-29 14:18:45 +02:00
|
|
|
constexpr static const auto GitHubApiURL = "https://api.github.com/repos/WerWolv/ImHex";
|
|
|
|
|
2022-02-01 22:09:44 +01:00
|
|
|
using u8 = std::uint8_t;
|
|
|
|
using u16 = std::uint16_t;
|
|
|
|
using u32 = std::uint32_t;
|
|
|
|
using u64 = std::uint64_t;
|
2022-01-24 20:53:17 +01:00
|
|
|
using u128 = __uint128_t;
|
|
|
|
|
2022-02-01 22:09:44 +01:00
|
|
|
using i8 = std::int8_t;
|
|
|
|
using i16 = std::int16_t;
|
|
|
|
using i32 = std::int32_t;
|
|
|
|
using i64 = std::int64_t;
|
2022-01-24 20:53:17 +01:00
|
|
|
using i128 = __int128_t;
|
2020-11-10 15:26:38 +01:00
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
using color_t = u32;
|
|
|
|
|
2021-09-09 01:56:48 +02:00
|
|
|
namespace hex {
|
|
|
|
|
|
|
|
struct Region {
|
|
|
|
u64 address;
|
|
|
|
size_t size;
|
2022-05-27 20:42:07 +02:00
|
|
|
|
|
|
|
[[nodiscard]] constexpr bool isWithin(const Region &other) const {
|
|
|
|
return (this->address >= other.address) && ((this->address + this->size) <= (other.address + other.size));
|
|
|
|
}
|
|
|
|
|
|
|
|
[[nodiscard]] constexpr bool overlaps(const Region &other) const {
|
|
|
|
return ((this->address + this->size) >= other.address) && (this->address < (other.address + other.size));
|
|
|
|
}
|
|
|
|
|
|
|
|
[[nodiscard]] constexpr u64 getStartAddress() const {
|
|
|
|
return this->address;
|
|
|
|
}
|
|
|
|
|
|
|
|
[[nodiscard]] constexpr u64 getEndAddress() const {
|
|
|
|
return this->address + this->size - 1;
|
|
|
|
}
|
2021-09-09 01:56:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|