summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@sun.com>2009-02-23 14:53:51 +0200
committerAlexey Kopytov <Alexey.Kopytov@sun.com>2009-02-23 14:53:51 +0200
commit1ba7c35e5c5f75cd61e5653287cbf4a741cdc6e7 (patch)
tree6669de4d085344b5823a424cd77bba61a5e33954 /sql
parenteecf716a833990408e14b3aff13509e11dd80cac (diff)
parentcebaf077d2b46496a4a9111244b6412a7ca6b790 (diff)
downloadmariadb-git-1ba7c35e5c5f75cd61e5653287cbf4a741cdc6e7.tar.gz
Automerge.
Diffstat (limited to 'sql')
-rw-r--r--sql/mysqld.cc51
1 files changed, 28 insertions, 23 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index ca68976d939..7856309b095 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -186,39 +186,44 @@ int initgroups(const char *,unsigned int);
#ifdef HAVE_FP_EXCEPT // Fix type conflict
typedef fp_except fp_except_t;
#endif
+#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
+#ifdef HAVE_FENV_H
+#include <fenv.h>
+#endif
+#ifdef HAVE_SYS_FPU_H
+/* for IRIX to use set_fpc_csr() */
+#include <sys/fpu.h>
+#endif
+inline void setup_fpu()
+{
+#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
/* We can't handle floating point exceptions with threads, so disable
this on freebsd
+ Don't fall for overflow, underflow,divide-by-zero or loss of precision
*/
-
-inline void set_proper_floating_point_mode()
-{
- /* Don't fall for overflow, underflow,divide-by-zero or loss of precision */
#if defined(__i386__)
fpsetmask(~(FP_X_INV | FP_X_DNML | FP_X_OFL | FP_X_UFL | FP_X_DZ |
FP_X_IMP));
#else
- fpsetmask(~(FP_X_INV | FP_X_OFL | FP_X_UFL | FP_X_DZ |
- FP_X_IMP));
-#endif
-}
-#elif defined(__sgi)
-/* for IRIX to use set_fpc_csr() */
-#include <sys/fpu.h>
+ fpsetmask(~(FP_X_INV | FP_X_OFL | FP_X_UFL | FP_X_DZ |
+ FP_X_IMP));
+#endif /* __i386__ */
+#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
-inline void set_proper_floating_point_mode()
-{
+#ifdef HAVE_FESETROUND
+ /* Set FPU rounding mode to "round-to-nearest" */
+ fesetround(FE_TONEAREST);
+#endif /* HAVE_FESETROUND */
+
+#if defined(__sgi) && defined(HAVE_SYS_FPU_H)
/* Enable denormalized DOUBLE values support for IRIX */
- {
- union fpc_csr n;
- n.fc_word = get_fpc_csr();
- n.fc_struct.flush = 0;
- set_fpc_csr(n.fc_word);
- }
+ union fpc_csr n;
+ n.fc_word = get_fpc_csr();
+ n.fc_struct.flush = 0;
+ set_fpc_csr(n.fc_word);
+#endif
}
-#else
-#define set_proper_floating_point_mode()
-#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
} /* cplusplus */
@@ -3279,7 +3284,7 @@ static int init_server_components()
query_cache_init();
query_cache_resize(query_cache_size);
randominit(&sql_rand,(ulong) server_start_time,(ulong) server_start_time/2);
- set_proper_floating_point_mode();
+ setup_fpu();
init_thr_lock();
#ifdef HAVE_REPLICATION
init_slave_list();