-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: mark Relocation constructors as explicit (#74)
- moved `Offset` to it's own header - some formatting changes
- Loading branch information
Showing
5 changed files
with
120 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include "REL/Module.h" | ||
|
||
namespace REL | ||
{ | ||
class Offset | ||
{ | ||
public: | ||
constexpr Offset() = default; | ||
|
||
constexpr Offset(const std::ptrdiff_t a_offset) : | ||
_offset(a_offset) | ||
{} | ||
|
||
[[nodiscard]] constexpr std::uintptr_t offset() const noexcept | ||
{ | ||
return _offset; | ||
} | ||
|
||
[[nodiscard]] constexpr std::uintptr_t address() const noexcept | ||
{ | ||
return Module::get().base() + _offset; | ||
} | ||
|
||
private: | ||
std::ptrdiff_t _offset{ 0 }; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters