summaryrefslogtreecommitdiff
path: root/include/fud_string.hpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2025-03-31 00:47:45 -0500
committerDominick Allen <djallen@librehumanitas.org>2025-03-31 00:47:45 -0500
commitc426110f24516f92ecb8a5374e2a281f2c79787a (patch)
tree3c77e1f7ec007d5dd7a444f651240b6ac7db8976 /include/fud_string.hpp
parent2e09b3020acb39430bc57a7481984fdfdbac5a12 (diff)
Fix Vector bug.
Diffstat (limited to 'include/fud_string.hpp')
-rw-r--r--include/fud_string.hpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/include/fud_string.hpp b/include/fud_string.hpp
index 1d724f0..1c189c2 100644
--- a/include/fud_string.hpp
+++ b/include/fud_string.hpp
@@ -157,8 +157,7 @@ class String {
fudAssert(totalLength < maxStringLength);
String output{};
- // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
- output.m_allocator = reinterpret_cast<uintptr_t>(allocator);
+ output.m_allocator = std::bit_cast<uintptr_t>(allocator);
utf8* data{nullptr};
size_t outputCapacity = totalLength + 1;
bool isLarge = outputCapacity > SsoBufSize;
@@ -355,14 +354,12 @@ class String {
[[nodiscard]] static bool allocatorValid(Allocator* allocator)
{
- // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
- return (reinterpret_cast<uintptr_t>(allocator) & isLargeMask) == 0;
+ return (std::bit_cast<uintptr_t>(allocator) & isLargeMask) == 0;
}
[[nodiscard]] Allocator* allocator() const
{
- // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast,performance-no-int-to-ptr)
- auto* allocPtr = reinterpret_cast<Allocator*>(m_allocator & allocatorMask);
+ auto* allocPtr = std::bit_cast<Allocator*>(m_allocator & allocatorMask);
fudAssert(allocPtr != nullptr);
return allocPtr;
}
@@ -388,8 +385,7 @@ class String {
/** \brief The allocator used to get storage for characters when the string
* is large. */
- // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
- uintptr_t m_allocator{reinterpret_cast<uintptr_t>(&globalFudAllocator)};
+ uintptr_t m_allocator{std::bit_cast<uintptr_t>(&globalFudAllocator)};
using BufType = Array<utf8, SsoBufSize>;
union {