]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
ppc/jm-insns.c: Use proper integer types.
authorBart Van Assche <bvanassche@acm.org>
Wed, 6 Oct 2010 16:13:17 +0000 (16:13 +0000)
committerBart Van Assche <bvanassche@acm.org>
Wed, 6 Oct 2010 16:13:17 +0000 (16:13 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11401

none/tests/ppc32/jm-insns.c

index 5ed0fabb632635117b0591e7654e12a354dbd193..8cc96a2c03d72d28723683281dbcc39a453401d1 100644 (file)
@@ -169,6 +169,8 @@ case I chased).
 #include "tests/sys_mman.h"
 #include "tests/malloc.h"       // memalign16
 
+#define STATIC_ASSERT(e) sizeof(struct { int:-!(e); })
+
 /* Something of the same size as void*, so can be safely be coerced
  * to/from a pointer type. Also same size as the host's gp registers.
  * According to the AltiVec section of the GCC manual, the syntax does
@@ -176,16 +178,25 @@ case I chased).
  * with the vector keyword, so typedefs uint[32|64]_t are #undef'ed here
  * and redefined using #define.
  */
-#ifndef __powerpc64__
 #undef uint32_t
+#undef uint64_t
 #define uint32_t unsigned int
-typedef uint32_t  HWord_t;
+#ifndef __powerpc64__
+#define uint64_t unsigned long long
 #else
-#undef uint64_t
 #define uint64_t unsigned long
+#endif /* __powerpc64__ */
+
+#ifndef __powerpc64__
+typedef uint32_t  HWord_t;
+#else
 typedef uint64_t  HWord_t;
-#endif // #ifndef __powerpc64__
+#endif /* __powerpc64__ */
 
+enum {
+    compile_time_test1 = STATIC_ASSERT(sizeof(uint32_t) == 4),
+    compile_time_test2 = STATIC_ASSERT(sizeof(uint64_t) == 8),
+};
 
 #define ALLCR "cr0","cr1","cr2","cr3","cr4","cr5","cr6","cr7"