diff options
author | Dominick Allen <djallen@librehumanitas.org> | 2024-10-29 00:11:13 -0500 |
---|---|---|
committer | Dominick Allen <djallen@librehumanitas.org> | 2024-10-29 00:11:13 -0500 |
commit | 24cd7c8896b2091114e89ffda06b5c63eb2827c7 (patch) | |
tree | 07ff832dae924fd8e16328e41dfed690b9154889 /include | |
parent | afc11065bb151349090d8ae89cb61d1c35bdddae (diff) |
Back out of modified SSO.
Diffstat (limited to 'include')
-rw-r--r-- | include/fud_string.hpp | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/include/fud_string.hpp b/include/fud_string.hpp index 29b887a..55b1e86 100644 --- a/include/fud_string.hpp +++ b/include/fud_string.hpp @@ -326,57 +326,15 @@ class String { FudStatus resize(size_t newCapacity); - [[nodiscard]] bool optIsLarge() const - { - return (reinterpret_cast<uintptr_t>(m_allocator) & capacityMask) != 0; - } - - public: - static constexpr size_t OptBufSize = 2 * sizeof(size_t) + sizeof(utf8*) - 1; - using OptBufType = Array<utf8, OptBufSize>; - size_t optLength() const - { - if (optIsLarge()) { - return m_large.optLength; - } - return m_small.optLength; - } - - size_t optCapacity() const - { - if (optIsLarge()) { - return m_large.optCapacity; - } - return OptBufSize - 1U; - } - - private: void setLength(size_t newLength) { m_length = newLength; - if (optIsLarge()) { - m_large.optLength = newLength; - } else { - m_small.optLength = static_cast<uint8_t>(newLength); - } } /** \brief The allocator used to get storage for characters when the string * is large. */ Allocator* m_allocator{&globalFudAllocator}; - union { - struct { - size_t optLength; - size_t optCapacity; - utf8* optData; - } m_large; - struct { - uint8_t optLength; - OptBufType optBuffer; - } m_small; - }; - using BufType = Array<utf8, SSO_BUF_SIZE>; union { /** \brief The storage for string characters when using SSO. */ |