aboutsummaryrefslogtreecommitdiff
path: root/zencore/include
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-10-20 13:19:39 +0200
committerMartin Ridgers <[email protected]>2021-10-20 13:19:39 +0200
commit13feae57532a1ad4d14feb5ee00f397fa6c370cc (patch)
tree4bfdfe0aa239435baddef9ee64965c39ec7f6551 /zencore/include
parentCompile fixes due to std::fs::path's differing character types (diff)
parentzen server: Added root manifest, with support for explicit schema versioning (diff)
downloadzen-13feae57532a1ad4d14feb5ee00f397fa6c370cc.tar.xz
zen-13feae57532a1ad4d14feb5ee00f397fa6c370cc.zip
Merged main
Diffstat (limited to 'zencore/include')
-rw-r--r--zencore/include/zencore/compactbinary.h2
-rw-r--r--zencore/include/zencore/iobuffer.h3
-rw-r--r--zencore/include/zencore/string.h4
3 files changed, 7 insertions, 2 deletions
diff --git a/zencore/include/zencore/compactbinary.h b/zencore/include/zencore/compactbinary.h
index ab01402f8..06331c510 100644
--- a/zencore/include/zencore/compactbinary.h
+++ b/zencore/include/zencore/compactbinary.h
@@ -43,6 +43,8 @@ public:
inline uint64_t GetTicks() const { return Ticks; }
+ static DateTime Now();
+
int GetYear() const;
int GetMonth() const;
int GetDay() const;
diff --git a/zencore/include/zencore/iobuffer.h b/zencore/include/zencore/iobuffer.h
index 60fee1dc5..847bed606 100644
--- a/zencore/include/zencore/iobuffer.h
+++ b/zencore/include/zencore/iobuffer.h
@@ -357,6 +357,9 @@ public:
[[nodiscard]] inline ZenContentType GetContentType() const { return m_Core->GetContentType(); }
[[nodiscard]] ZENCORE_API bool GetFileReference(IoBufferFileReference& OutRef) const;
+ template<typename T>
+ [[nodiscard]] const T* Data() const { return reinterpret_cast<const T*>(m_Core->DataPointer()); }
+
private:
RefPtr<IoBufferCore> m_Core = new IoBufferCore;
diff --git a/zencore/include/zencore/string.h b/zencore/include/zencore/string.h
index e2a957786..47fd5643d 100644
--- a/zencore/include/zencore/string.h
+++ b/zencore/include/zencore/string.h
@@ -631,7 +631,7 @@ HashStringAsLowerDjb2(const std::string_view& InString)
{
uint32_t HashValue = 5381;
- for (int CurChar : InString)
+ for (uint8_t CurChar : InString)
{
CurChar -= ((CurChar - 'A') <= ('Z' - 'A')) * ('A' - 'a'); // this should be compiled into branchless logic
HashValue = HashValue * 33 + CurChar;
@@ -649,7 +649,7 @@ ToLower(const std::string_view& InString)
for (char& CurChar : Out)
{
- CurChar -= ((CurChar - 'A') <= ('Z' - 'A')) * ('A' - 'a'); // this should be compiled into branchless logic
+ CurChar -= (uint8_t(CurChar - 'A') <= ('Z' - 'A')) * ('A' - 'a'); // this should be compiled into branchless logic
}
return Out;