Fix IO Port code again
This commit is contained in:
@@ -9,27 +9,26 @@ namespace JabyEngine {
|
||||
T value;
|
||||
|
||||
public:
|
||||
//For easy access
|
||||
constexpr T read() const {
|
||||
return const_cast<volatile IOPort<T>*>(this)->value;
|
||||
return const_cast<const volatile decltype(this)>(this)->value;
|
||||
}
|
||||
|
||||
constexpr void write(T value) {
|
||||
const_cast<volatile IOPort<T>*>(this)->value = value;
|
||||
template<typename...ARGS>
|
||||
constexpr void write_combined(const ARGS&... value) {
|
||||
IOPort::write(T::with(value...));
|
||||
}
|
||||
|
||||
constexpr volatile T& ref() {
|
||||
return const_cast<volatile IOPort<T>*>(this)->value;
|
||||
template<typename S>
|
||||
constexpr void write(const BitRangeValue<S>& value) {
|
||||
IOPort::write(T::with(value));
|
||||
}
|
||||
|
||||
constexpr const volatile T& ref() const {
|
||||
return const_cast<volatile IOPort<T>*>(this)->value;
|
||||
constexpr void write(const T& value) {
|
||||
const_cast<volatile decltype(this)>(this)->value = value;
|
||||
}
|
||||
|
||||
constexpr IOPort<T>& operator=(T value) {
|
||||
IOPort::write(value);
|
||||
return *this;
|
||||
}
|
||||
// We keep this a POD so we will not add assignment operators anymore
|
||||
// We also removed ref() to be more percise
|
||||
};
|
||||
|
||||
struct __no_align ubus32_t {
|
||||
|
||||
Reference in New Issue
Block a user