================
@@ -0,0 +1,42 @@
+// RUN: %clang_cc1 -triple powerpc64-unknown -fsyntax-only -verify 
-ffreestanding %s
+// RUN: %clang_cc1 -triple powerpc64-unknown -fsyntax-only -verify -xc++ 
-ffreestanding %s
+// RUN: %clang_cc1 -triple ppc64le-unknown -fsyntax-only -verify 
-ffreestanding %s
+// RUN: %clang_cc1 -triple ppc64le-unknown -fsyntax-only -verify -xc++ 
-ffreestanding %s
+// expected-no-diagnostics
+
+#include <endian.h>
+
+
+#if BYTE_ORDER == BIG_ENDIAN
+
+_Static_assert(htobe16(0xBEEF) == 0xBEEF, "");
+_Static_assert(htobe32(0xDEADBEEF) == 0xDEADBEEF, "");
+_Static_assert(htobe64(0xDEADBEEFDEADBEEF) == 0xDEADBEEFDEADBEEF, "");
+_Static_assert(htole16(0xBEEF) == 0xEFBE, "");
+_Static_assert(htole32(0xDEADBEEF) == 0xEFBEADDE, "");
+_Static_assert(htole64(0xDEADBEEFDEADBEEF) == 0xEFBEADDEEFBEADDE, "");
----------------
hubert-reinterpretcast wrote:

Might be more reasonable to go with something where the first and second half 
are distinct, e.g., `DEADBEEFBAADF00D`.

https://github.com/llvm/llvm-project/pull/186032
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to