Use write and read for BitRangeValues

This commit is contained in:
2023-01-15 20:21:48 +01:00
parent 3687fda821
commit db8a51fff9
6 changed files with 11 additions and 7 deletions

View File

@@ -33,6 +33,10 @@ namespace JabyEngine {
T value;
size_t begin;
size_t length;
constexpr BitRangeValue() = default;
constexpr BitRangeValue(T value, size_t begin, size_t length) : value(value), begin(begin), length(length) {
}
};
template<typename T>
@@ -47,7 +51,7 @@ namespace JabyEngine {
}
constexpr BitRangeValue<T> with(T value) const {
return {value, this->begin, this->length};
return BitRangeValue(value, this->begin, this->length);
}
constexpr BitRangeValue<T> max() const {

View File

@@ -43,7 +43,7 @@ namespace JabyEngine {
}
static void ack(VolatileBitMapPOD<InterruptFlag>& port) {
port.write_range_value(InterruptFlag::InterruptTypValue.max());
port.write(InterruptFlag::InterruptTypValue.max());
}
};

View File

@@ -31,7 +31,7 @@ namespace JabyEngine {
return T{this->pod.read()};
}
constexpr Raw read_range_value(const BitRange<Raw>& range) const {
constexpr Raw read(const BitRange<Raw>& range) const {
return VolatileBitMapPOD<T>::read().get_value(range);
}
@@ -43,7 +43,7 @@ namespace JabyEngine {
this->pod.write(static_cast<Raw>(value));
}
constexpr void write_range_value(const BitRangeValue<Raw>& value) {
constexpr void write(const BitRangeValue<Raw>& value) {
VolatileBitMapPOD<T>::write(T{T::with(value)});
}
};

View File

@@ -66,7 +66,7 @@ namespace JabyEngine {
~HighResTime() = delete;
static TimeStamp get_time_stamp() {
return TimeStamp(HighResTime::global_counter_10ms, Timer_IO::Counter2.value.read_range_value(Timer_IO::CounterValue::Value));
return TimeStamp(HighResTime::global_counter_10ms, Timer_IO::Counter2.value.read(Timer_IO::CounterValue::Value));
}
};
#endif //JABYENGINE_USE_HIGH_PERCISION_TIMER