diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2013-04-15 22:20:22 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2013-04-15 22:21:16 +0200 |
commit | ac038aaf08d2c1047f2327ecaab17e84ca214015 (patch) | |
tree | 4cee9f8f6f782eedf8d90a08d9324c33f2498a48 /src | |
parent | 81be8dc99ba7558c8915310eed095df43e3bdbf7 (diff) | |
download | manaserv-ac038aaf08d2c1047f2327ecaab17e84ca214015.tar.gz manaserv-ac038aaf08d2c1047f2327ecaab17e84ca214015.tar.bz2 manaserv-ac038aaf08d2c1047f2327ecaab17e84ca214015.tar.xz manaserv-ac038aaf08d2c1047f2327ecaab17e84ca214015.zip |
Used static_assert for static assertion
Yay for C++11! static_assert is available since GCC 4.3.
Fixed warning when compiling with GCC 4.8:
src/utils/mathutils.cpp:53:18: warning: typedef ‘float_must_be_32_bits’
locally defined but not used [-Wunused-local-typedefs]
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/mathutils.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/utils/mathutils.cpp b/src/utils/mathutils.cpp index 6f7bc223..a11538e5 100644 --- a/src/utils/mathutils.cpp +++ b/src/utils/mathutils.cpp @@ -50,7 +50,8 @@ namespace math { */ float fastInvSqrt(float x) { - typedef char float_must_be_32_bits[(sizeof(float) == 4) * 2 - 1]; + static_assert(sizeof(float) == 4, "float must be 32 bits"); + float xhalf = 0.5f * x; uint32_t i; memcpy(&i, &x, 4); |