2525
2626#include "opal/class/opal_pointer_array.h"
2727#include "opal/class/opal_hash_table.h"
28+ #include "opal/util/minmax.h"
2829#include "opal/util/printf.h"
2930
3031static opal_hash_table_t mca_base_pvar_index_hash ;
3132static opal_pointer_array_t registered_pvars ;
3233static bool mca_base_pvar_initialized = false;
3334static int pvar_count = 0 ;
3435
35- #define min (a ,b ) ((a) < (b) ? (a) : (b))
36- #define max (a ,b ) ((a) > (b) ? (a) : (b))
37-
3836static int mca_base_pvar_get_internal (int index , mca_base_pvar_t * * pvar , bool invalidok );
3937
4038/* string representations of class names */
@@ -610,20 +608,20 @@ int mca_base_pvar_handle_update (mca_base_pvar_handle_t *handle)
610608 if (MCA_BASE_PVAR_CLASS_LOWWATERMARK == handle -> pvar -> var_class ) {
611609 switch (handle -> pvar -> type ) {
612610 case MCA_BASE_VAR_TYPE_UNSIGNED_INT :
613- ((unsigned * ) handle -> current_value )[i ] = min (((unsigned * ) handle -> tmp_value )[i ],
614- ((unsigned * ) handle -> current_value )[i ]);
611+ ((unsigned * ) handle -> current_value )[i ] = opal_min (((unsigned * ) handle -> tmp_value )[i ],
612+ ((unsigned * ) handle -> current_value )[i ]);
615613 break ;
616614 case MCA_BASE_VAR_TYPE_UNSIGNED_LONG :
617- ((unsigned long * ) handle -> current_value )[i ] = min (((unsigned long * ) handle -> tmp_value )[i ],
618- ((unsigned long * ) handle -> current_value )[i ]);
615+ ((unsigned long * ) handle -> current_value )[i ] = opal_min (((unsigned long * ) handle -> tmp_value )[i ],
616+ ((unsigned long * ) handle -> current_value )[i ]);
619617 break ;
620618 case MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG :
621- ((unsigned long long * ) handle -> current_value )[i ] = min (((unsigned long long * ) handle -> tmp_value )[i ],
622- ((unsigned long long * ) handle -> current_value )[i ]);
619+ ((unsigned long long * ) handle -> current_value )[i ] = opal_min (((unsigned long long * ) handle -> tmp_value )[i ],
620+ ((unsigned long long * ) handle -> current_value )[i ]);
623621 break ;
624622 case MCA_BASE_VAR_TYPE_DOUBLE :
625- ((double * ) handle -> current_value )[i ] = min (((double * ) handle -> tmp_value )[i ],
626- ((double * ) handle -> current_value )[i ]);
623+ ((double * ) handle -> current_value )[i ] = opal_min (((double * ) handle -> tmp_value )[i ],
624+ ((double * ) handle -> current_value )[i ]);
627625 break ;
628626 default :
629627 /* shouldn't happen */
@@ -632,20 +630,20 @@ int mca_base_pvar_handle_update (mca_base_pvar_handle_t *handle)
632630 } else {
633631 switch (handle -> pvar -> type ) {
634632 case MCA_BASE_VAR_TYPE_UNSIGNED_INT :
635- ((unsigned * ) handle -> current_value )[i ] = max (((unsigned * ) handle -> tmp_value )[i ],
636- ((unsigned * ) handle -> current_value )[i ]);
633+ ((unsigned * ) handle -> current_value )[i ] = opal_max (((unsigned * ) handle -> tmp_value )[i ],
634+ ((unsigned * ) handle -> current_value )[i ]);
637635 break ;
638636 case MCA_BASE_VAR_TYPE_UNSIGNED_LONG :
639- ((unsigned long * ) handle -> current_value )[i ] = max (((unsigned long * ) handle -> tmp_value )[i ],
640- ((unsigned long * ) handle -> current_value )[i ]);
637+ ((unsigned long * ) handle -> current_value )[i ] = opal_max (((unsigned long * ) handle -> tmp_value )[i ],
638+ ((unsigned long * ) handle -> current_value )[i ]);
641639 break ;
642640 case MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG :
643- ((unsigned long long * ) handle -> current_value )[i ] = max (((unsigned long long * ) handle -> tmp_value )[i ],
644- ((unsigned long long * ) handle -> current_value )[i ]);
641+ ((unsigned long long * ) handle -> current_value )[i ] = opal_max (((unsigned long long * ) handle -> tmp_value )[i ],
642+ ((unsigned long long * ) handle -> current_value )[i ]);
645643 break ;
646644 case MCA_BASE_VAR_TYPE_DOUBLE :
647- ((double * ) handle -> current_value )[i ] = max (((double * ) handle -> tmp_value )[i ],
648- ((double * ) handle -> current_value )[i ]);
645+ ((double * ) handle -> current_value )[i ] = opal_max (((double * ) handle -> tmp_value )[i ],
646+ ((double * ) handle -> current_value )[i ]);
649647 break ;
650648 default :
651649 /* shouldn't happen */
0 commit comments