BigFile/Sasquatch #1
@@ -12,6 +12,8 @@
|
||||
#include <System/File/MemoryMappedFile.hpp>
|
||||
#include <System/UUID/UUID.hpp>
|
||||
|
||||
#include <Utils/TargetMacros.h>
|
||||
|
||||
#include <EASTL/span.h>
|
||||
#include <EASTL/vector.h>
|
||||
#include <ankerl/unordered_dense.h>
|
||||
@@ -97,7 +99,7 @@ class SasquatchWriter
|
||||
/**
|
||||
* The number of assets expected
|
||||
*/
|
||||
std::uint64_t m_assetCount;
|
||||
BIGFOOT_NOT_OPTIMIZED_ONLY(std::uint64_t m_assetCount);
|
||||
|
||||
/**
|
||||
* The offset the next WriteAsset call will write to
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Bigfoot
|
||||
SasquatchWriter::SasquatchWriter(const File& p_file,
|
||||
const std::uint64_t p_assetCount,
|
||||
const std::size_t p_totalFlatbufferBytes):
|
||||
m_assetCount(p_assetCount),
|
||||
BIGFOOT_NOT_OPTIMIZED_ONLY(m_assetCount(p_assetCount),)
|
||||
m_nextOffset(sizeof(SasquatchHeader) + p_assetCount * sizeof(SasquatchEntry)),
|
||||
m_prefetchedUpTo(0),
|
||||
m_file(p_file, m_nextOffset + p_totalFlatbufferBytes)
|
||||
@@ -42,9 +42,12 @@ SasquatchWriter::~SasquatchWriter()
|
||||
|
||||
m_file.Prefetch(sizeof(SasquatchHeader), m_entries.size() * sizeof(SasquatchEntry));
|
||||
|
||||
std::memcpy(m_file.GetData().data() + sizeof(SasquatchHeader),
|
||||
m_entries.data(),
|
||||
m_entries.size() * sizeof(SasquatchEntry));
|
||||
if (!m_entries.empty())
|
||||
{
|
||||
std::memcpy(m_file.GetData().data() + sizeof(SasquatchHeader),
|
||||
m_entries.data(),
|
||||
m_entries.size() * sizeof(SasquatchEntry));
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
@@ -118,7 +121,10 @@ Sasquatch::Sasquatch(const File& p_file):
|
||||
sizeof(SasquatchHeader) + header.m_assetCount * sizeof(SasquatchEntry));
|
||||
|
||||
eastl::vector<SasquatchEntry> entries(header.m_assetCount);
|
||||
std::memcpy(entries.data(), data.data() + sizeof(SasquatchHeader), entries.size() * sizeof(SasquatchEntry));
|
||||
if (!entries.empty())
|
||||
{
|
||||
std::memcpy(entries.data(), data.data() + sizeof(SasquatchHeader), entries.size() * sizeof(SasquatchEntry));
|
||||
}
|
||||
|
||||
m_entries.reserve(header.m_assetCount);
|
||||
for (const SasquatchEntry& entry: entries)
|
||||
|
||||
Reference in New Issue
Block a user