[libc-commits] [libc] [libc] fix and explicit atomic difference from c++ (PR #119715)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Thu Dec 12 09:14:13 PST 2024


================
@@ -62,6 +62,18 @@ template <typename T> struct Atomic {
     return static_cast<int>(mem_scope);
   }
 
+  LIBC_INLINE static T *addressof(T &ref) { return __builtin_addressof(ref); }
+
+  // require types that are 1, 2, 4, 8, or 16 bytes in length to be aligned to
+  // at least their size to be potentially
+  // used lock-free
----------------
nickdesaulniers wrote:

```suggestion
  // Require types that are 1, 2, 4, 8, or 16 bytes in length to be aligned to
  // at least their size to be potentially used lock-free.
```
Though perhaps its worth rephrasing this in terms of "minimum alignment?"

https://reviews.llvm.org/D54814

https://github.com/llvm/llvm-project/pull/119715


More information about the libc-commits mailing list