summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/fud_string.hpp42
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. */