2017-12-31 23:49:35 +00:00
|
|
|
//
|
|
|
|
// AddressMapper.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 30/12/2017.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2017 Thomas Harte. All rights reserved.
|
2017-12-31 23:49:35 +00:00
|
|
|
//
|
|
|
|
|
2024-01-17 04:34:46 +00:00
|
|
|
#pragma once
|
2017-12-31 23:49:35 +00:00
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
|
2023-05-10 21:02:18 +00:00
|
|
|
namespace Analyser::Static::Disassembler {
|
2017-12-31 23:49:35 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Provides an address mapper that relocates a chunk of memory so that it starts at
|
|
|
|
address @c start_address.
|
|
|
|
*/
|
2024-11-30 02:08:35 +00:00
|
|
|
template <typename T> std::function<std::size_t(T)> OffsetMapper(const T start_address) {
|
2017-12-31 23:49:35 +00:00
|
|
|
return [start_address](T argument) {
|
2020-05-10 03:00:39 +00:00
|
|
|
return size_t(argument - start_address);
|
2017-12-31 23:49:35 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|