Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / utils / mono-math.c
1 /**
2  * \file
3  */
4
5 #include "mono-math.h"
6
7 #ifndef HAVE_SIGNBIT
8
9 /**
10  * mono_signbit_float:
11  */
12 int
13 mono_signbit_float (float x)
14 {
15         union { float f; int i; } u;
16
17         u.f = x;
18
19         return u.i < 0;
20 }
21
22 /**
23  * mono_signbit_double:
24  */
25 int
26 mono_signbit_double (double x)
27 {
28         union { double d; int i[2]; } u;
29
30         u.d = x;
31
32 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
33         return u.i [1] < 0;
34 #else
35         return u.i [0] < 0;
36 #endif
37 }
38
39 #endif