Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
one set of macros for min/max is enough
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 6 Mar 2016 20:37:56 +0000 (21:37 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 6 Mar 2016 20:37:56 +0000 (21:37 +0100)
examples/msg/bittorrent/peer.c
examples/msg/mc/bugged2.c
include/xbt/base.h
src/smpi/colls/allgatherv-mpich-rdb.c
src/smpi/colls/reduce-binomial.c
src/smpi/colls/reduce_scatter-mpich.c
src/xbt/log.c

index 372194b..0ef1d35 100644 (file)
@@ -781,7 +781,7 @@ void send_request_to_peer(peer_t peer, connection_t remote_peer, int piece)
   block_index = get_first_block(peer, piece);
   if (block_index != -1) {
     block_length = PIECES_BLOCKS - block_index;
   block_index = get_first_block(peer, piece);
   if (block_index != -1) {
     block_length = PIECES_BLOCKS - block_index;
-    block_length = min(BLOCKS_REQUESTED, block_length);
+    block_length = MIN(BLOCKS_REQUESTED, block_length);
     send_request(peer, remote_peer->mailbox, piece, block_index, block_length);
   }
 }
     send_request(peer, remote_peer->mailbox, piece, block_index, block_length);
   }
 }
index a0376a8..4cda68c 100644 (file)
@@ -36,7 +36,7 @@ int server(int argc, char *argv[])
   task2 = NULL;
   XBT_INFO("Received %lu", val2);
 
   task2 = NULL;
   XBT_INFO("Received %lu", val2);
 
-  MC_assert(min(val1, val2) == 1);
+  MC_assert(MIN(val1, val2) == 1);
 
   MSG_task_receive(&task1, "mymailbox");
   val1 = xbt_str_parse_int(MSG_task_get_name(task1), "Task name is not a numerical ID: %s");
 
   MSG_task_receive(&task1, "mymailbox");
   val1 = xbt_str_parse_int(MSG_task_get_name(task1), "Task name is not a numerical ID: %s");
index d266b5a..4347e66 100644 (file)
 
 #endif
 
 
 #endif
 
-#if !defined (max) && !defined(__cplusplus)
-#  define max(a,b)  (((a) > (b)) ? (a) : (b))
-#endif
-#if !defined (min) && !defined(__cplusplus)
-#  define min(a,b)  (((a) < (b)) ? (a) : (b))
-#endif
-
 #define TRUE  1
 #define FALSE 0
 
 #define TRUE  1
 #define FALSE 0
 
index e4edda9..fcf9079 100644 (file)
@@ -42,7 +42,7 @@ int smpi_coll_tuned_allgatherv_mpich_rdb (
 
   smpi_datatype_extent(recvtype, &recvtype_true_lb, &recvtype_true_extent);
 
 
   smpi_datatype_extent(recvtype, &recvtype_true_lb, &recvtype_true_extent);
 
-  tmp_buf_rl= (void*)smpi_get_tmp_sendbuffer(total_count*(max(recvtype_true_extent,recvtype_extent)));
+  tmp_buf_rl= (void*)smpi_get_tmp_sendbuffer(total_count*(MAX(recvtype_true_extent,recvtype_extent)));
 
   /* adjust for potential negative lower bound in datatype */
   tmp_buf = (void *)((char*)tmp_buf_rl - recvtype_true_lb);
 
   /* adjust for potential negative lower bound in datatype */
   tmp_buf = (void *)((char*)tmp_buf_rl - recvtype_true_lb);
index 607bb6f..180a07d 100644 (file)
@@ -46,7 +46,7 @@ int smpi_coll_tuned_reduce_binomial(void *sendbuf, void *recvbuf, int count,
   /* If I'm not the root, then my recvbuf may not be valid, therefore
      I have to allocate a temporary one */
   if (rank != root) {
   /* If I'm not the root, then my recvbuf may not be valid, therefore
      I have to allocate a temporary one */
   if (rank != root) {
-      recvbuf = (void *) smpi_get_tmp_recvbuffer(count*(max(extent,true_extent)));
+      recvbuf = (void *) smpi_get_tmp_recvbuffer(count*(MAX(extent,true_extent)));
       recvbuf = (void *)((char*)recvbuf - true_lb);
   }
    if ((rank != root) || (sendbuf != MPI_IN_PLACE)) {
       recvbuf = (void *)((char*)recvbuf - true_lb);
   }
    if ((rank != root) || (sendbuf != MPI_IN_PLACE)) {
index 83a802b..447cc33 100644 (file)
@@ -63,7 +63,7 @@ int smpi_coll_tuned_reduce_scatter_mpich_pair(void *sendbuf, void *recvbuf, int
         }
         
         /* allocate temporary buffer to store incoming data */
         }
         
         /* allocate temporary buffer to store incoming data */
-        tmp_recvbuf = (void*)smpi_get_tmp_recvbuffer(recvcounts[rank]*(max(true_extent,extent))+1);
+        tmp_recvbuf = (void*)smpi_get_tmp_recvbuffer(recvcounts[rank]*(MAX(true_extent,extent))+1);
         /* adjust for potential negative lower bound in datatype */
         tmp_recvbuf = (void *)((char*)tmp_recvbuf - true_lb);
         
         /* adjust for potential negative lower bound in datatype */
         tmp_recvbuf = (void *)((char*)tmp_recvbuf - true_lb);
         
@@ -300,13 +300,13 @@ int smpi_coll_tuned_reduce_scatter_mpich_rdb(void *sendbuf, void *recvbuf, int r
             /* noncommutative and (non-pof2 or block irregular), use recursive doubling. */
 
             /* need to allocate temporary buffer to receive incoming data*/
             /* noncommutative and (non-pof2 or block irregular), use recursive doubling. */
 
             /* need to allocate temporary buffer to receive incoming data*/
-            tmp_recvbuf= (void *) smpi_get_tmp_recvbuffer( total_count*(max(true_extent,extent)));
+            tmp_recvbuf= (void *) smpi_get_tmp_recvbuffer( total_count*(MAX(true_extent,extent)));
             /* adjust for potential negative lower bound in datatype */
             tmp_recvbuf = (void *)((char*)tmp_recvbuf - true_lb);
 
             /* need to allocate another temporary buffer to accumulate
                results */
             /* adjust for potential negative lower bound in datatype */
             tmp_recvbuf = (void *)((char*)tmp_recvbuf - true_lb);
 
             /* need to allocate another temporary buffer to accumulate
                results */
-            tmp_results = (void *)smpi_get_tmp_sendbuffer( total_count*(max(true_extent,extent)));
+            tmp_results = (void *)smpi_get_tmp_sendbuffer( total_count*(MAX(true_extent,extent)));
             /* adjust for potential negative lower bound in datatype */
             tmp_results = (void *)((char*)tmp_results - true_lb);
 
             /* adjust for potential negative lower bound in datatype */
             tmp_results = (void *)((char*)tmp_results - true_lb);
 
index 2019f4c..075e482 100644 (file)
@@ -1161,7 +1161,7 @@ static xbt_log_setting_t _xbt_log_parse_setting(const char *control_string)
     set->fmt = xbt_strdup(eq + 1);
   } else {
     char buff[512];
     set->fmt = xbt_strdup(eq + 1);
   } else {
     char buff[512];
-    snprintf(buff, min(512, eq - dot), "%s", dot + 1);
+    snprintf(buff, MIN(512, eq - dot), "%s", dot + 1);
     THROWF(arg_error, 0, "Unknown setting of the log category: '%s'",
            buff);
   }
     THROWF(arg_error, 0, "Unknown setting of the log category: '%s'",
            buff);
   }