glsl: Define isnormal and copysign for MSVC to fix build.
authorVinson Lee <vlee@freedesktop.org>
Sun, 22 Sep 2013 23:08:26 +0000 (16:08 -0700)
committerVinson Lee <vlee@freedesktop.org>
Sun, 22 Sep 2013 23:11:36 +0000 (16:11 -0700)
This patch fixes these MSVC build errors.

ir_constant_expression.cpp
src\glsl\ir_constant_expression.cpp(564) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
src\glsl\ir_constant_expression.cpp(1384) : error C3861: 'isnormal': identifier not found
src\glsl\ir_constant_expression.cpp(1385) : error C3861: 'copysign': identifier not found

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69541
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Acked-by: Matt Turner <mattst88@gmail.com>
src/glsl/ir_constant_expression.cpp

index 4579ef209dae87891d5f4a6b452856418a8ec9d0..12641e5df10936e6e23364f0c2699bd20b4bcd2a 100644 (file)
 #include "glsl_types.h"
 #include "program/hash_table.h"
 
+#if defined(_MSC_VER) && (_MSC_VER < 1800)
+static int isnormal(double x)
+{
+   return _fpclass(x) == _FPCLASS_NN || _fpclass(x) == _FPCLASS_PN;
+}
+#endif
+
+#if defined(_MSC_VER)
+static double copysign(double x, double y)
+{
+   return _copysign(x, y);
+}
+#endif
+
 static float
 dot(ir_constant *op0, ir_constant *op1)
 {