Skip to content

Commit

Permalink
Try to fix macos build
Browse files Browse the repository at this point in the history
  • Loading branch information
daid committed Dec 23, 2024
1 parent 863881b commit 6a8d5cd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/io/dataBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@ class DataBuffer
i = readVLQu64();
}

#ifdef __MACOS__
void read(size_t& i)
{
i = readVLQu64();
}
#endif

void read(float& f)
{
if (read_index + sizeof(f) > buffer.size()) { f = 0; return; }
Expand Down Expand Up @@ -234,6 +241,11 @@ class DataBuffer
DataBuffer& operator >>(double& data) { read(data); return *this; }
DataBuffer& operator >>(string& data) { read(data); return *this; }

#ifdef __MACOS__
DataBuffer& operator <<(size_t data) { write(uint64_t(data)); return *this; }
DataBuffer& operator >>(size_t& data) { read(data); return *this; }
#endif

template<typename T, class=typename std::enable_if_t< std::is_enum_v<T>>> DataBuffer& operator <<(T data) { write(int(data)); return *this; }
template<typename T, class=typename std::enable_if_t< std::is_enum_v<T>>> DataBuffer& operator >>(T& data) { int n = 0; read(n); data = T(n); return *this; }
private:
Expand Down

0 comments on commit 6a8d5cd

Please sign in to comment.