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
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef AddressMapper_hpp
|
|
|
|
#define AddressMapper_hpp
|
|
|
|
|
|
|
|
#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.
|
|
|
|
*/
|
|
|
|
template <typename T> std::function<std::size_t(T)> OffsetMapper(T start_address) {
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* AddressMapper_hpp */
|