]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/atomic/test/aligned_object.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / atomic / test / aligned_object.hpp
index 9a8098782d171623dd849980e6f6035d80ac705f..a6b77bb45bc9892f7843c0bf55990eb500f14302 100644 (file)
@@ -52,9 +52,11 @@ private:
 #else
         typedef std::size_t uintptr_type;
 #endif
-        uintptr_type p = (uintptr_type)(unsigned char*)m_storage;
-        p = (p + (uintptr_type)(Alignment - 1u)) & ~(uintptr_type)(Alignment - 1u);
-        return (unsigned char*)p;
+        unsigned char* p = m_storage;
+        uintptr_type misalignment = ((uintptr_type)p) & (Alignment - 1u);
+        if (misalignment > 0)
+            p += Alignment - misalignment;
+        return p;
     }
 };