clang/gcc: enable a bunch more warnings (#91)

* clang/gcc: enable -pedantic warnings

* suppress a GCC-specific warning in stb_image

* And some clang-specific warnings

* -Wconversion (clang) -Wold-style-cast (clang+gcc)

and fix a few warnings that show up with these (and a few more with
-Wconversion on gcc, even though that's not enabled by default)

* bunch more warnings

* fixes

* remove merge error
diff --git a/src/common/Math.cpp b/src/common/Math.cpp
index 5fc2a40..1552c87 100644
--- a/src/common/Math.cpp
+++ b/src/common/Math.cpp
@@ -28,7 +28,7 @@
         ASSERT(ret != 0);
         return firstBitIndex;
     #else
-        return static_cast<unsigned long>(__builtin_ctz(bits));
+        return static_cast<uint32_t>(__builtin_ctz(bits));
     #endif
 }
 
@@ -40,7 +40,7 @@
         ASSERT(ret != 0);
         return firstBitIndex;
     #else
-        return 31 - __builtin_clz(value);
+        return 31 - static_cast<uint32_t>(__builtin_clz(value));
     #endif
 }
 
@@ -52,13 +52,13 @@
 bool IsAligned(const void* ptr, size_t alignment) {
     ASSERT(IsPowerOfTwo(alignment));
     ASSERT(alignment != 0);
-    return (reinterpret_cast<intptr_t>(ptr) & (alignment - 1)) == 0;
+    return (reinterpret_cast<size_t>(ptr) & (alignment - 1)) == 0;
 }
 
 void* AlignVoidPtr(void* ptr, size_t alignment) {
     ASSERT(IsPowerOfTwo(alignment));
     ASSERT(alignment != 0);
-    return reinterpret_cast<void*>((reinterpret_cast<intptr_t>(ptr) + (alignment - 1)) & ~(alignment - 1));
+    return reinterpret_cast<void*>((reinterpret_cast<size_t>(ptr) + (alignment - 1)) & ~(alignment - 1));
 }
 
 uint32_t Align(uint32_t value, size_t alignment) {