From ac038aaf08d2c1047f2327ecaab17e84ca214015 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Mon, 15 Apr 2013 22:20:22 +0200 Subject: Used static_assert for static assertion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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] --- src/utils/mathutils.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/utils/mathutils.cpp') 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); -- cgit v1.2.3-70-g09d2