mirror of
https://github.com/thunderbrewhq/common.git
synced 2025-12-12 03:02:29 +00:00
chore(datastore): clean up getter for uint8_t
This commit is contained in:
parent
30c34ca015
commit
42f36f2888
1 changed files with 4 additions and 2 deletions
|
|
@ -45,12 +45,14 @@ void CDataStore::Finalize() {
|
||||||
CDataStore& CDataStore::Get(uint8_t& val) {
|
CDataStore& CDataStore::Get(uint8_t& val) {
|
||||||
STORM_ASSERT(this->IsFinal());
|
STORM_ASSERT(this->IsFinal());
|
||||||
|
|
||||||
if (this->FetchRead(this->m_read, 1)) {
|
auto bytes = sizeof(val);
|
||||||
|
|
||||||
|
if (this->FetchRead(this->m_read, bytes)) {
|
||||||
auto ofs = this->m_read - this->m_base;
|
auto ofs = this->m_read - this->m_base;
|
||||||
auto ptr = &this->m_data[ofs];
|
auto ptr = &this->m_data[ofs];
|
||||||
val = *reinterpret_cast<uint8_t*>(ptr);
|
val = *reinterpret_cast<uint8_t*>(ptr);
|
||||||
|
|
||||||
this->m_read += sizeof(val);
|
this->m_read += bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue