mirror of
https://github.com/libretro/bsnes-libretro.git
synced 2024-11-27 02:50:32 +00:00
4c3f58150c
byuu says: Changelog: - added (poorly-named) castable<To, With> template - Z80 debugger rewritten to make declaring instructions much simpler - Z80 has more instructions implemented; supports displacement on (IX), (IY) now - added `Processor::M68K::Bus` to mirror `Processor::Z80::Bus` - it does add a pointer indirection; so I'm not sure if I want to do this for all of my emulator cores ...
28 lines
661 B
C++
28 lines
661 B
C++
#pragma once
|
|
|
|
#include <utility>
|
|
|
|
namespace nall {
|
|
|
|
template<typename T> struct base_from_member {
|
|
base_from_member(T value) : value(value) {}
|
|
T value;
|
|
};
|
|
|
|
template<typename To, typename With> struct castable {
|
|
operator To&() { return (To&)value; }
|
|
operator const To&() const { return (const To&)value; }
|
|
operator With&() { return value; }
|
|
operator const With&() const { return value; }
|
|
auto& operator=(const With& value) { return this->value = value; }
|
|
With value;
|
|
};
|
|
|
|
template<typename T> inline auto allocate(uint size, const T& value) -> T* {
|
|
T* array = new T[size];
|
|
for(uint i = 0; i < size; i++) array[i] = value;
|
|
return array;
|
|
}
|
|
|
|
}
|