diff src/sanity.cc @ 109:f05330267c66

Use stdint types.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 06 Oct 2014 12:59:23 +0300
parents a68786b9c74b
children
line wrap: on
line diff
--- a/src/sanity.cc	Mon Oct 06 12:46:32 2014 +0300
+++ b/src/sanity.cc	Mon Oct 06 12:59:23 2014 +0300
@@ -40,44 +40,45 @@
  *        Useful when porting.
  */
 
-#define assert_size(type,size)                                                \
-  do                                                                        \
-  {                                                                        \
-    if (sizeof (type) != size)                                                \
-      fatal_error ("sizeof " #type " is %d (should be " #size ")",        \
+#define assert_size(type,size)                                               \
+  do                                                                         \
+  {                                                                          \
+    if (sizeof (type) != size)                                               \
+      fatal_error ("sizeof " #type " is %d (should be " #size ")",           \
         (int) sizeof (type));                                                \
-  }                                                                        \
+  }                                                                          \
   while (0)
 
-#define assert_wrap(type,high,low)                                        \
-  do                                                                        \
-  {                                                                        \
-    type n = high;                                                        \
-    if (++n != low)                                                        \
+#define assert_wrap(type,high,low)                                           \
+  do                                                                         \
+  {                                                                          \
+    type n = high;                                                           \
+    if (++n != low)                                                          \
       fatal_error ("Type " #type " wraps around to %lu (should be " #low ")",\
-        (unsigned long) n);                                                \
-  }                                                                        \
+        (unsigned long) n);                                                  \
+  }                                                                          \
   while (0)
 
+
 void check_types()
 {
-    assert_size(u8, 1);
-    assert_size(i8, 1);
-    assert_size(u16, 2);
-    assert_size(i16, 2);
-    assert_size(u32, 4);
-    assert_size(i32, 4);
+    assert_size(uint8_t, 1);
+    assert_size(int8_t, 1);
+    assert_size(uint16_t, 2);
+    assert_size(int16_t, 2);
+    assert_size(uint32_t, 4);
+    assert_size(int32_t, 4);
     assert_size(struct LineDef, 14);
     assert_size(struct Sector, 26);
     assert_size(struct SideDef, 30);
     assert_size(struct Thing, 10);
     assert_size(struct Vertex, 4);
-    assert_wrap(u8, 255, 0);
-    assert_wrap(i8, 127, -128);
-    assert_wrap(u16, 65535, 0);
-    assert_wrap(i16, 32767, -32768);
-    assert_wrap(u32, 4294967295u, 0);
-    assert_wrap(i32, 2147483647, -2147483648);
+    assert_wrap(uint8_t, 255, 0);
+    assert_wrap(int8_t, 127, -128);
+    assert_wrap(uint16_t, 65535, 0);
+    assert_wrap(int16_t, 32767, -32768);
+    assert_wrap(uint32_t, 4294967295u, 0);
+    assert_wrap(int32_t, 2147483647, -2147483648);
 }