================
@@ -230,18 +230,18 @@ void MemCpyAccessible(void *dest, const void *src, uptr 
n) {
   uptr e = reinterpret_cast<uptr>(src) + n;
   uptr e_down = RoundDownTo(e, page_size);
 
-  auto copy_or_zero = [dest, src](uptr b, uptr e) {
-    uptr d = reinterpret_cast<uptr>(dest) + (b - reinterpret_cast<uptr>(src));
-    if (!TryMemCpy(reinterpret_cast<void *>(d), reinterpret_cast<void *>(b),
-                   e - b))
-      internal_memset(reinterpret_cast<void *>(d), 0, e - b);
+  const uptr off = reinterpret_cast<uptr>(dest) - b;
+
+  auto copy_or_zero = [off](uptr beg, uptr end) {
+    void *d = reinterpret_cast<void *>(beg + off);
----------------
fmayer wrote:

i preferred the previous calculation, it's weird to have the offset between 
source and destination.

https://github.com/llvm/llvm-project/pull/112794
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to