[ox/preloader] Cleanup

This commit is contained in:
2023-02-25 22:25:14 -06:00
parent 1767821161
commit 317e714373
3 changed files with 19 additions and 10 deletions

View File

@@ -33,6 +33,7 @@ class Preloader: public ModelHandlerBase<Preloader<PlatSpec>> {
private:
using PtrType = typename PlatSpec::PtrType;
static constexpr auto PtrSize = sizeof(PtrType);
class UnionIdxTracker {
private:
int m_unionIdx = -1;
@@ -165,6 +166,7 @@ constexpr ox::Error Preloader<PlatSpec>::field(CRStringView name, const T *val)
}
oxReturnError(pad(val));
if constexpr(ox::is_integral_v<T>) {
//oxDebugf("Preloader::field(name, val): {}", name);
return ox::serialize(&m_writer, PlatSpec::correctEndianness(*val));
} else if constexpr(ox::is_pointer_v<T>) {
const PtrType a = startAlloc(sizeOf<PlatSpec>(*val), m_writer.tellp()) + PlatSpec::RomStart;
@@ -336,7 +338,7 @@ constexpr ox::Error Preloader<PlatSpec>::fieldVector(CRStringView, const auto *v
}
// serialize the Vector
oxReturnError(serialize(&m_writer, vecVal));
m_ptrs.emplace_back(m_writer.tellp() - PlatSpec::PtrSize, vecVal.items);
m_ptrs.emplace_back(m_writer.tellp() - PtrSize, vecVal.items);
return {};
}