INNER CODE UNIT · C++
current
evanbowman/BPCore-Engine · source/filesystem.cpp:118
auto current = reinterpret_cast<const FileInfo*>(addr_);
while (true) {
if (str_cmp(name, current->name_) == 0) {
return {reinterpret_cast<const char*>(current) + sizeof(FileInfo),
static_cast<u32>(tonum(current->size_))};
} else if (current->name_[0] not_eq '\0') {
auto skip = tonum(current->size_) + 1; // +1 for null terminator
skip += skip % 4; // word padding
const char* next_addr = reinterpret_cast<const char*>(current) +
sizeof(FileInfo) + skip;
current = reinterpret_cast<const FileInfo*>(next_addr);
} else {
return {nullptr, 0};
}