More TODO improvements

This commit is contained in:
2024-12-29 23:16:35 +01:00
parent 6143c2b798
commit c115fed0bd
4 changed files with 36 additions and 34 deletions

View File

@@ -28,10 +28,23 @@ namespace JabyEngine {
return {reinterpret_cast<ProcessRoutine>(process_routine), data_adr};
}
template<typename T>
T simple_read_r() {
static constexpr size_t T_SIZE = sizeof(T);
T value = *reinterpret_cast<const T*>(this->data_adr);
Configuration::processed(T_SIZE);
return value;
}
constexpr void processed(size_t bytes) {
this->data_adr += bytes;
this->data_bytes -= bytes;
}
constexpr void skip(size_t bytes) {
Configuration::processed(bytes);
}
};
Configuration config;

View File

@@ -6,14 +6,6 @@
namespace JabyEngine {
namespace FileProcessor {
namespace Helper {
template<typename T>
static void simple_read(T& dst, State::Configuration& config) {
static constexpr size_t T_SIZE = sizeof(T);
dst = *reinterpret_cast<const T*>(config.data_adr);
config.processed(T_SIZE);
}
template<typename T>
static Progress exchange_and_execute_process_function(State::GenericProcessRoutine<T> process_routine, State::Configuration& config, T& state) {
config.process_routine = reinterpret_cast<State::ProcessRoutine>(process_routine);