From d3425b2508e76ed7a09e55f0c6b580b4107f04db Mon Sep 17 00:00:00 2001 From: pknowles Date: Sat, 7 Feb 2026 16:19:02 -0800 Subject: [PATCH] pot align and explicit casts for clang --- include/decodeless/detail/mappedfile_linux.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/decodeless/detail/mappedfile_linux.hpp b/include/decodeless/detail/mappedfile_linux.hpp index 0a9cae4..67ea917 100644 --- a/include/decodeless/detail/mappedfile_linux.hpp +++ b/include/decodeless/detail/mappedfile_linux.hpp @@ -74,7 +74,7 @@ class FileDescriptor { } size_t size() const { return static_cast(stat().st_size); } void truncate(size_t size) { - if (ftruncate(m_fd, size) == -1) + if (ftruncate(m_fd, static_cast(size)) == -1) throw LastError(); } explicit operator bool() const = delete; // possibly unexpected due to operator int() @@ -133,7 +133,7 @@ class MemoryMap { requires Writable { assert(offset + size <= m_size); - size_t alignedOffset = offset & ~(pageSize() - 1); + size_t alignedOffset = offset & ~static_cast(pageSize() - 1); size_t alignedSize = size + offset - alignedOffset; void* offsetAddress = static_cast( static_cast(const_cast(m_address)) + alignedOffset); @@ -294,8 +294,8 @@ class ResizableMappedMemory { throw std::bad_alloc(); // Align to the next page boundary - size_t ps = pageSize(); - size_t newMappedSize = ((size + ps - 1) / ps) * ps; + size_t ps = static_cast(pageSize()); + size_t newMappedSize = (size + ps - 1) & ~(ps - 1); if (newMappedSize > m_mappedSize) { // Add just the new range