Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Change again the size of the problem for the MC.
[simgrid.git] / examples / msg / chord / chord.c
index 138a609..8f7b2f5 100644 (file)
@@ -131,14 +131,8 @@ static void chord_initialize(void)
  */
 static int normalize(int id)
 {
-  // make sure id >= 0
-  while (id < 0) {
-    id += nb_keys;
-  }
-  // make sure id < nb_keys
-  id = id % nb_keys;
-
-  return id;
+  // like id % nb_keys, but works with negatives numbers (and faster)
+  return id & (nb_keys - 1);
 }
 
 /**
@@ -256,6 +250,13 @@ static void set_predecessor(node_t node, int predecessor_id)
  */
 int node(int argc, char *argv[])
 {
+  /* Reduce the run size for the MC */
+  if(MC_IS_ENABLED){
+    periodic_stabilize_delay = 8;
+    periodic_fix_fingers_delay = 8;
+    periodic_check_predecessor_delay = 8;
+  }
+
   double init_time = MSG_get_clock();
   m_task_t task_received = NULL;
   msg_comm_t comm_send = NULL;