Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
tesh: actually pick the path to python3 that we have
[simgrid.git] / src / xbt / xbt_main.cpp
index 026641b..d90feb1 100644 (file)
@@ -8,11 +8,12 @@
 
 #define XBT_LOG_LOCALLY_DEFINE_XBT_CHANNEL /* MSVC don't want it to be declared extern in headers and local here */
 
-
+#include <math.h>
 #include "xbt/misc.h"
 #include "simgrid_config.h"
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
+#include "xbt/log.hpp"
 #include "xbt/dynar.h"
 #include "xbt/config.h"
 
@@ -87,11 +88,7 @@ static void xbt_preinit(void) {
   #error Cannot get page size.
 #endif
 
-  xbt_pagebits = 0;
-  int x = xbt_pagesize;
-  while(x >>= 1) {
-    ++xbt_pagebits;
-  }
+  xbt_pagebits = log2(xbt_pagesize);
 
 #ifdef _TWO_DIGIT_EXPONENT
   /* Even printf behaves differently on Windows... */
@@ -129,7 +126,7 @@ static void xbt_postexit(void)
 /** @brief Initialize the xbt mechanisms. */
 void xbt_init(int *argc, char **argv)
 {
-  xbt_set_terminate();
+  simgrid::xbt::installExceptionHandler();
 
   if (xbt_initialized++) {
     XBT_DEBUG("XBT was initialized %d times.", xbt_initialized);