[libc-commits] [PATCH] D125966: [libc][mem*] Address facility + test enum support

Clement Courbet via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue May 31 01:43:07 PDT 2022


courbet added inline comments.


================
Comment at: libc/src/string/memory_utils/address.h:74
+    } else if constexpr (!is_power2(ByteOffsetModuloAlignment)) {
+      return 1;
+    } else {
----------------
This is suboptimal for `ALIGNMENT=8` and `ByteOffset=6`, which has `ByteOffsetModuloAlignment=6`, and therefore returns `1` instead of `2`.


================
Comment at: libc/test/src/string/memory_utils/address_test.cpp:47
+  ASSERT_EQ(offsetAddr<10>(SrcAddr<4>(nullptr)).ALIGNMENT, 2UL);
+}
+
----------------
`ASSERT_EQ(offsetAddr<6>(SrcAddr<8>(nullptr)).ALIGNMENT, 2UL);` ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125966/new/

https://reviews.llvm.org/D125966



More information about the libc-commits mailing list