[PATCH] D17563: [MSan] Endianness should not matter while printing a byte

Mohit Bhakkad via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 00:36:36 PST 2016


mohit.bhakkad created this revision.
mohit.bhakkad added a reviewer: eugenis.
mohit.bhakkad added subscribers: llvm-commits, jaydeep, sagar.
mohit.bhakkad set the repository for this revision to rL LLVM.

Print the hex digits of each byte in the most significant first order, and print different bytes in the memory order.

Repository:
  rL LLVM

http://reviews.llvm.org/D17563

Files:
  lib/msan/msan.cc
  lib/msan/msan_report.cc

Index: lib/msan/msan_report.cc
===================================================================
--- lib/msan/msan_report.cc
+++ lib/msan/msan_report.cc
@@ -221,11 +221,7 @@
     } else {
       unsigned char v = *(unsigned char *)s;
       if (v) last_quad_poisoned = true;
-#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-      Printf("%x%x", v & 0xf, v >> 4);
-#else
       Printf("%x%x", v >> 4, v & 0xf);
-#endif
     }
     // Group end.
     if (pos % 4 == 3 && with_origins) {
Index: lib/msan/msan.cc
===================================================================
--- lib/msan/msan.cc
+++ lib/msan/msan.cc
@@ -462,13 +462,8 @@
   }
 
   unsigned char *s = (unsigned char*)MEM_TO_SHADOW(x);
-  for (uptr i = 0; i < size; i++) {
-#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-    Printf("%x%x ", s[i] & 0xf, s[i] >> 4);
-#else
+  for (uptr i = 0; i < size; i++)
     Printf("%x%x ", s[i] >> 4, s[i] & 0xf);
-#endif
-  }
   Printf("\n");
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17563.48891.patch
Type: text/x-patch
Size: 955 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160224/0550afd9/attachment.bin>


More information about the llvm-commits mailing list