Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
hunt down some more short negation forms
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 23 May 2017 22:11:19 +0000 (00:11 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 23 May 2017 22:11:19 +0000 (00:11 +0200)
31 files changed:
examples/s4u/dht-chord/s4u_dht-chord.hpp
include/simgrid/kernel/future.hpp
include/simgrid/s4u/ConditionVariable.hpp
include/simgrid/s4u/Host.hpp
include/simgrid/simix/blocking_simcall.hpp
include/xbt/config.hpp
include/xbt/exception.hpp
include/xbt/functional.hpp
src/instr/instr_interface.cpp
src/mc/Process.cpp
src/mc/Process.hpp
src/mc/mc_config.cpp
src/mc/mc_snapshot.cpp
src/mc/remote/RemotePtr.hpp
src/smpi/colls/allgather/allgather-ompi-neighborexchange.cpp
src/smpi/colls/coll_tuned_topo.cpp
src/smpi/colls/scatter/scatter-ompi.cpp
src/smpi/colls/smpi_mvapich2_selector.cpp
src/smpi/smpi_datatype.cpp
src/smpi/smpi_datatype_derived.cpp
src/smpi/smpi_keyvals.hpp
src/smpi/smpi_op.cpp
src/smpi/smpi_request.cpp
src/smpi/smpi_win.cpp
src/surf/fair_bottleneck.cpp
src/surf/lagrange.cpp
src/surf/maxmin.cpp
src/surf/network_cm02.cpp
src/surf/trace_mgr.hpp
src/xbt/dict.cpp
src/xbt/ex.cpp

index 7b64d2c..c3a3a53 100644 (file)
@@ -118,7 +118,7 @@ public:
       join(known_id_);
     }
 
-    if (!joined)
+    if (not joined)
       return;
     ChordMessage* message              = nullptr;
     void* data                         = nullptr;
@@ -131,7 +131,7 @@ public:
     while ((now < (start_time_ + deadline_)) && now < MAX_SIMULATION_TIME) {
       data                             = nullptr;
       simgrid::s4u::Comm& comm_receive = simgrid::s4u::this_actor::irecv(mailbox_, &data);
-      while ((now < (start_time_ + deadline_)) && now < MAX_SIMULATION_TIME && !comm_receive.test()) {
+      while ((now < (start_time_ + deadline_)) && now < MAX_SIMULATION_TIME && not comm_receive.test()) {
         // no task was received: make some periodic calls
         if (now >= next_stabilize_date) {
           stabilize();
index da5bd08..8f0c25d 100644 (file)
@@ -61,7 +61,7 @@ public:
 
   void set_continuation(simgrid::xbt::Task<void()>&& continuation)
   {
-    xbt_assert(!continuation_);
+    xbt_assert(not continuation_);
     switch (status_) {
     case FutureStatus::done:
       // This is not supposed to happen if continuation is set
@@ -369,12 +369,9 @@ public:
    *                     the future is ready
    * @exception std::future_error no state is associated with the future
    */
-  template<class F>
-  auto then(F continuation)
-  -> typename std::enable_if<
-       !is_future<decltype(continuation(std::move(*this)))>::value,
-       Future<decltype(continuation(std::move(*this)))>
-     >::type
+  template <class F>
+  auto then(F continuation) -> typename std::enable_if<not is_future<decltype(continuation(std::move(*this)))>::value,
+                                                       Future<decltype(continuation(std::move(*this)))>>::type
   {
     return this->thenNoUnwrap(std::move(continuation));
   }
index c087a0e..b1e2be3 100644 (file)
@@ -52,7 +52,7 @@ public:
   void wait(std::unique_lock<Mutex> & lock);
   template <class P> void wait(std::unique_lock<Mutex> & lock, P pred)
   {
-    while (!pred())
+    while (not pred())
       wait(lock);
   }
 
@@ -62,7 +62,7 @@ public:
   std::cv_status wait_for(std::unique_lock<Mutex> & lock, double duration);
   template <class P> bool wait_until(std::unique_lock<Mutex> & lock, double timeout_time, P pred)
   {
-    while (!pred())
+    while (not pred())
       if (this->wait_until(lock, timeout_time) == std::cv_status::timeout)
         return pred();
     return true;
index 999098f..665f2c8 100644 (file)
@@ -83,7 +83,7 @@ public:
   /** Returns if that host is currently up and running */
   bool isOn();
   /** Returns if that host is currently down and offline */
-  bool isOff() { return !isOn(); }
+  bool isOff() { return not isOn(); }
 
   double speed();
   int coreCount();
index 6341521..88e522c 100644 (file)
@@ -87,7 +87,7 @@ public:
   bool valid() const { return future_.valid(); }
   T get()
   {
-    if (!valid())
+    if (not valid())
       throw std::future_error(std::future_errc::no_state);
     smx_actor_t self = SIMIX_process_self();
     simgrid::xbt::Result<T> result;
@@ -109,7 +109,7 @@ public:
   }
   bool is_ready() const
   {
-    if (!valid())
+    if (not valid())
       throw std::future_error(std::future_errc::no_state);
     return future_.is_ready();
   }
index 4e0e222..f5b3c95 100644 (file)
@@ -168,8 +168,8 @@ typename std::enable_if<std::is_same<
 bindFlag(T& value, const char* name, const char* description,
   F callback)
 {
-  declareFlag(name, description, value, [&value,callback](const T& val) {
-    if (!callback(val))
+  declareFlag(name, description, value, [&value, callback](const T& val) {
+    if (not callback(val))
       throw std::range_error("invalid value");
     value = std::move(val);
   });
index 9be76a2..ea18bc0 100644 (file)
@@ -104,9 +104,7 @@ template<class E>
 class WithContext : public E, public WithContextException
 {
 public:
-
-  static_assert(!std::is_base_of<WithContextException,E>::value,
-    "Trying to appli WithContext twice");
+  static_assert(not std::is_base_of<WithContextException, E>::value, "Trying to appli WithContext twice");
 
   WithContext(E exception) :
     E(std::move(exception)) {}
index 10c16bf..b93f958 100644 (file)
@@ -232,9 +232,7 @@ private:
     vtable_ = &vtable;
   }
 
-  template<class F>
-  typename std::enable_if<!canSBO<F>()>::type
-  init(F code)
+  template <class F> typename std::enable_if<not canSBO<F>()>::type init(F code)
   {
     const static TaskVtable vtable {
       // Call:
index dbefe45..79dc5d3 100644 (file)
@@ -84,7 +84,7 @@ void TRACE_category_with_color (const char *category, const char *color)
   if (not TRACE_is_enabled() || not TRACE_needs_platform())
     return;
 
-  if (!(TRACE_categorized() && category != nullptr))
+  if (not(TRACE_categorized() && category != nullptr))
     return;
 
   //check if category is already created
index 4e5090a..26447a3 100644 (file)
@@ -335,7 +335,7 @@ void Process::init_memory_map_info()
       continue;
 
     current_name = pathname;
-    if (!(reg.prot & PROT_READ) && (reg.prot & PROT_EXEC))
+    if (not(reg.prot & PROT_READ) && (reg.prot & PROT_EXEC))
       continue;
 
     const bool is_executable = not i;
index 16e481f..68ebb05 100644 (file)
@@ -143,13 +143,13 @@ public:
   // Heap access:
   xbt_mheap_t get_heap()
   {
-    if (!(this->cache_flags_ & Process::cache_heap))
+    if (not(this->cache_flags_ & Process::cache_heap))
       this->refresh_heap();
     return this->heap.get();
   }
   const malloc_info* get_malloc_info()
   {
-    if (!(this->cache_flags_ & Process::cache_malloc))
+    if (not(this->cache_flags_ & Process::cache_malloc))
       this->refresh_malloc_info();
     return this->heap_info.data();
   }
@@ -226,7 +226,7 @@ public:
   simgrid::mc::ActorInformation* resolveActorInfo(simgrid::mc::RemotePtr<simgrid::simix::ActorImpl> actor)
   {
     xbt_assert(mc_model_checker != nullptr);
-    if (!actor)
+    if (not actor)
       return nullptr;
     this->refresh_simix();
     for (auto& actor_info : this->smx_actors_infos)
index a288a17..5f7ed7b 100644 (file)
@@ -40,7 +40,7 @@ int _sg_mc_timeout = 0;
 
 void _mc_cfg_cb_timeout(const char *name)
 {
-  if (_sg_cfg_init_status && !(_sg_do_model_check || MC_record_path))
+  if (_sg_cfg_init_status && not(_sg_do_model_check || MC_record_path))
     xbt_die("You are specifying a value to enable/disable timeout for wait requests after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
 
   _sg_mc_timeout = xbt_cfg_get_boolean(name);
index 784f672..32f035b 100644 (file)
@@ -35,7 +35,7 @@ mc_mem_region_t mc_get_snapshot_region(
   size_t n = snapshot->snapshot_regions.size();
   for (size_t i = 0; i != n; ++i) {
     mc_mem_region_t region = snapshot->snapshot_regions[i].get();
-    if (!(region && region->contain(simgrid::mc::remote(addr))))
+    if (not(region && region->contain(simgrid::mc::remote(addr))))
       continue;
 
     if (region->storage_type() == simgrid::mc::StorageType::Privatized) {
index 88effca..951b60c 100644 (file)
@@ -89,7 +89,7 @@ public:
   T* local() const { return (T*)address_; }
 
   operator bool() const { return address_; }
-  bool operator!() const { return !address_; }
+  bool operator!() const { return not address_; }
   operator RemotePtr<void>() const { return RemotePtr<void>(address_); }
   RemotePtr<T> operator+(std::uint64_t n) const { return RemotePtr<T>(address_ + n * sizeof(T)); }
   RemotePtr<T> operator-(std::uint64_t n) const { return RemotePtr<T>(address_ - n * sizeof(T)); }
index 8f4d2a9..cb350c6 100644 (file)
@@ -115,7 +115,7 @@ Coll_allgather_ompi_neighborexchange::allgather(void *sbuf, int scount,
    } 
 
    /* Determine neighbors, order in which blocks will arrive, etc. */
-   even_rank = !(rank % 2);
+   even_rank = not(rank % 2);
    if (even_rank) {
       neighbor[0] = (rank + 1) % size;
       neighbor[1] = (rank - 1 + size) % size;
index 4f128a5..f90e726 100644 (file)
@@ -295,7 +295,7 @@ int ompi_coll_tuned_topo_destroy_tree( ompi_coll_tree_t** tree )
 {
     ompi_coll_tree_t *ptr;
 
-    if ((not tree) || (!*tree)) {
+    if ((tree == nullptr) || (*tree == nullptr)) {
       return MPI_SUCCESS;
     }
 
index 6a622b3..9d14907 100644 (file)
@@ -109,7 +109,7 @@ int Coll_scatter_ompi_binomial::scatter(void* sbuf, int scount, MPI_Datatype sdt
         }
       }
       total_send = scount;
-    } else if (!(vrank % 2)) {
+    } else if (not(vrank % 2)) {
       /* non-root, non-leaf nodes, allocate temp buffer for recv
        * the most we need is rcount*size/2 */
       tempbuf = (char*)smpi_get_tmp_recvbuffer(rtrue_extent + (rcount * size - 1) * rextent);
@@ -130,7 +130,7 @@ int Coll_scatter_ompi_binomial::scatter(void* sbuf, int scount, MPI_Datatype sdt
       ptmp = (char*)rbuf;
     }
 
-    if (!(vrank % 2)) {
+    if (not(vrank % 2)) {
       if (rank != root) {
         /* recv from parent on non-root */
         Request::recv(ptmp, rcount * size, rdtype, bmtree->tree_prev, COLL_TAG_SCATTER, comm, &status);
index 8be7648..99290fb 100644 (file)
@@ -304,13 +304,9 @@ int Coll_allgatherv_mvapich2::allgatherv(void *sendbuf, int sendcount, MPI_Datat
 
   if (MV2_Allgatherv_function == &MPIR_Allgatherv_Rec_Doubling_MV2)
     {
-      if(!(comm_size & (comm_size - 1)))
-        {
-          mpi_errno =
-              MPIR_Allgatherv_Rec_Doubling_MV2(sendbuf, sendcount,
-                  sendtype, recvbuf,
-                  recvcounts, displs,
-                  recvtype, comm);
+    if (not(comm_size & (comm_size - 1))) {
+      mpi_errno =
+          MPIR_Allgatherv_Rec_Doubling_MV2(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm);
         } else {
             mpi_errno =
                 MPIR_Allgatherv_Bruck_MV2(sendbuf, sendcount,
index 00eb043..b5ea234 100644 (file)
@@ -121,8 +121,8 @@ Datatype::Datatype(Datatype *datatype, int* ret) : name_(nullptr), lb_(datatype-
   *ret = MPI_SUCCESS;
   if(datatype->name_)
     name_ = xbt_strdup(datatype->name_);
-  
-  if(!(datatype->attributes()->empty())){
+
+  if (not datatype->attributes()->empty()) {
     int flag;
     void* value_out;
     for(auto it = datatype->attributes()->begin(); it != datatype->attributes()->end(); it++){
@@ -175,7 +175,7 @@ void Datatype::unref(MPI_Datatype datatype)
   if (datatype->refcount_ > 0)
     datatype->refcount_--;
 
-  if (datatype->refcount_ == 0  && !(datatype->flags_ & DT_FLAG_PREDEFINED))
+  if (datatype->refcount_ == 0 && not(datatype->flags_ & DT_FLAG_PREDEFINED))
     delete datatype;
 
 #if SIMGRID_HAVE_MC
@@ -276,16 +276,12 @@ int Datatype::copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     recvcount *= recvtype->size();
     count = sendcount < recvcount ? sendcount : recvcount;
 
-    if(!(sendtype->flags() & DT_FLAG_DERIVED) && !(recvtype->flags() & DT_FLAG_DERIVED)) {
+    if (not(sendtype->flags() & DT_FLAG_DERIVED) && not(recvtype->flags() & DT_FLAG_DERIVED)) {
       if (not smpi_process()->replaying())
         memcpy(recvbuf, sendbuf, count);
-    }
-    else if (!(sendtype->flags() & DT_FLAG_DERIVED))
-    {
+    } else if (not(sendtype->flags() & DT_FLAG_DERIVED)) {
       recvtype->unserialize( sendbuf, recvbuf, recvcount/recvtype->size(), MPI_REPLACE);
-    }
-    else if (!(recvtype->flags() & DT_FLAG_DERIVED))
-    {
+    } else if (not(recvtype->flags() & DT_FLAG_DERIVED)) {
       sendtype->serialize(sendbuf, recvbuf, sendcount/sendtype->size());
     }else{
 
index cc00885..afc16ca 100644 (file)
@@ -49,15 +49,14 @@ Type_Vector::~Type_Vector(){
 
 void Type_Vector::serialize( void* noncontiguous_buf, void *contiguous_buf, 
                             int count){
-  int i;
   char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
   char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf);
 
-  for (i = 0; i < block_count_ * count; i++) {
-      if (!(old_type_->flags() & DT_FLAG_DERIVED))
-        memcpy(contiguous_buf_char, noncontiguous_buf_char, block_length_ * old_type_->size());
-      else        
-        old_type_->serialize(noncontiguous_buf_char, contiguous_buf_char, block_length_);
+  for (int i = 0; i < block_count_ * count; i++) {
+    if (not(old_type_->flags() & DT_FLAG_DERIVED))
+      memcpy(contiguous_buf_char, noncontiguous_buf_char, block_length_ * old_type_->size());
+    else
+      old_type_->serialize(noncontiguous_buf_char, contiguous_buf_char, block_length_);
 
     contiguous_buf_char += block_length_*old_type_->size();
     if((i+1)%block_count_ ==0)
@@ -69,12 +68,11 @@ void Type_Vector::serialize( void* noncontiguous_buf, void *contiguous_buf,
 
 void Type_Vector::unserialize( void* contiguous_buf, void *noncontiguous_buf, 
                               int count, MPI_Op op){
-  int i;
   char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
   char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf);
 
-  for (i = 0; i < block_count_ * count; i++) {
-    if (!(old_type_->flags() & DT_FLAG_DERIVED)){
+  for (int i = 0; i < block_count_ * count; i++) {
+    if (not(old_type_->flags() & DT_FLAG_DERIVED)) {
       if(op != MPI_OP_NULL)
         op->apply(contiguous_buf_char, noncontiguous_buf_char, &block_length_,
           old_type_);
@@ -98,12 +96,11 @@ Type_Hvector::~Type_Hvector(){
 
 void Type_Hvector::serialize( void* noncontiguous_buf, void *contiguous_buf, 
                     int count){
-  int i;
   char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
   char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf);
 
-  for (i = 0; i < block_count_ * count; i++) {
-    if (!(old_type_->flags() & DT_FLAG_DERIVED))
+  for (int i = 0; i < block_count_ * count; i++) {
+    if (not(old_type_->flags() & DT_FLAG_DERIVED))
       memcpy(contiguous_buf_char, noncontiguous_buf_char, block_length_ * old_type_->size());
     else
       old_type_->serialize( noncontiguous_buf_char, contiguous_buf_char, block_length_);
@@ -119,12 +116,11 @@ void Type_Hvector::serialize( void* noncontiguous_buf, void *contiguous_buf,
 
 void Type_Hvector::unserialize( void* contiguous_buf, void *noncontiguous_buf, 
                               int count, MPI_Op op){
-  int i;
   char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
   char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf);
 
-  for (i = 0; i < block_count_ * count; i++) {
-    if (!(old_type_->flags() & DT_FLAG_DERIVED)){
+  for (int i = 0; i < block_count_ * count; i++) {
+    if (not(old_type_->flags() & DT_FLAG_DERIVED)) {
       if(op!=MPI_OP_NULL) 
         op->apply( contiguous_buf_char, noncontiguous_buf_char, &block_length_, old_type_);
     }else
@@ -162,7 +158,7 @@ void Type_Indexed::serialize( void* noncontiguous_buf, void *contiguous_buf,
   char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+block_indices_[0] * old_type_->size();
   for (int j = 0; j < count; j++) {
     for (int i = 0; i < block_count_; i++) {
-      if (!(old_type_->flags() & DT_FLAG_DERIVED))
+      if (not(old_type_->flags() & DT_FLAG_DERIVED))
         memcpy(contiguous_buf_char, noncontiguous_buf_char, block_lengths_[i] * old_type_->size());
       else
         old_type_->serialize( noncontiguous_buf_char, contiguous_buf_char, block_lengths_[i]);
@@ -186,7 +182,7 @@ void Type_Indexed::unserialize( void* contiguous_buf, void *noncontiguous_buf,
     static_cast<char*>(noncontiguous_buf)+block_indices_[0]*old_type_->get_extent();
   for (int j = 0; j < count; j++) {
     for (int i = 0; i < block_count_; i++) {
-      if (!(old_type_->flags() & DT_FLAG_DERIVED)){
+      if (not(old_type_->flags() & DT_FLAG_DERIVED)) {
         if(op!=MPI_OP_NULL) 
           op->apply( contiguous_buf_char, noncontiguous_buf_char, &block_lengths_[i],
                     old_type_);
@@ -230,7 +226,7 @@ void Type_Hindexed::serialize( void* noncontiguous_buf, void *contiguous_buf,
   char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+ block_indices_[0];
   for (int j = 0; j < count; j++) {
     for (int i = 0; i < block_count_; i++) {
-      if (!(old_type_->flags() & DT_FLAG_DERIVED))
+      if (not(old_type_->flags() & DT_FLAG_DERIVED))
         memcpy(contiguous_buf_char, noncontiguous_buf_char, block_lengths_[i] * old_type_->size());
       else
         old_type_->serialize(noncontiguous_buf_char, contiguous_buf_char,block_lengths_[i]);
@@ -251,7 +247,7 @@ void Type_Hindexed::unserialize( void* contiguous_buf, void *noncontiguous_buf,
   char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+ block_indices_[0];
   for (int j = 0; j < count; j++) {
     for (int i = 0; i < block_count_; i++) {
-      if (!(old_type_->flags() & DT_FLAG_DERIVED)){
+      if (not(old_type_->flags() & DT_FLAG_DERIVED)) {
         if(op!=MPI_OP_NULL) 
           op->apply( contiguous_buf_char, noncontiguous_buf_char, &block_lengths_[i],
                             old_type_);
@@ -298,7 +294,7 @@ void Type_Struct::serialize( void* noncontiguous_buf, void *contiguous_buf,
   char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+ block_indices_[0];
   for (int j = 0; j < count; j++) {
     for (int i = 0; i < block_count_; i++) {
-      if (!(old_types_[i]->flags() & DT_FLAG_DERIVED))
+      if (not(old_types_[i]->flags() & DT_FLAG_DERIVED))
         memcpy(contiguous_buf_char, noncontiguous_buf_char, block_lengths_[i] * old_types_[i]->size());
       else
         old_types_[i]->serialize( noncontiguous_buf_char,contiguous_buf_char,block_lengths_[i]);
@@ -320,7 +316,7 @@ void Type_Struct::unserialize( void* contiguous_buf, void *noncontiguous_buf,
   char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+ block_indices_[0];
   for (int j = 0; j < count; j++) {
     for (int i = 0; i < block_count_; i++) {
-      if (!(old_types_[i]->flags() & DT_FLAG_DERIVED)){
+      if (not(old_types_[i]->flags() & DT_FLAG_DERIVED)) {
         if(op!=MPI_OP_NULL) 
           op->apply( contiguous_buf_char, noncontiguous_buf_char, &block_lengths_[i], old_types_[i]);
       }else
index 92f3384..52ad77e 100644 (file)
@@ -137,7 +137,7 @@ template <typename T> int Keyval::attr_put(int keyval, void* attr_value){
 }
 
 template <typename T> void Keyval::cleanup_attr(){
-  if(!attributes()->empty()){
+  if (not attributes()->empty()) {
     int flag=0;
     for(auto it : attributes_){
       try{
index 5023a2e..35b0a73 100644 (file)
@@ -16,7 +16,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_op, smpi, "Logging specific to SMPI (op)");
 #define PROD_OP(a, b) (b) *= (a)
 #define LAND_OP(a, b) (b) = (a) && (b)
 #define LOR_OP(a, b)  (b) = (a) || (b)
-#define LXOR_OP(a, b) (b) = (!(a) && (b)) || ((a) && !(b))
+#define LXOR_OP(a, b) (b) = (not(a) && (b)) || ((a) && not(b))
 #define BAND_OP(a, b) (b) &= (a)
 #define BOR_OP(a, b)  (b) |= (a)
 #define BXOR_OP(a, b) (b) ^= (a)
index 0126847..ac052b4 100644 (file)
@@ -395,7 +395,7 @@ void Request::start()
       detached_ = 1;
       XBT_DEBUG("Send request %p is detached", this);
       refcount_++;
-      if(!(old_type_->flags() & DT_FLAG_DERIVED)){
+      if (not(old_type_->flags() & DT_FLAG_DERIVED)) {
         oldbuf = buf_;
         if (not process->replaying() && oldbuf != nullptr && size_ != 0) {
           if((smpi_privatize_global_variables != 0)
@@ -432,7 +432,7 @@ void Request::start()
     if (async_small_thresh != 0 || (flags_ & RMA) != 0)
       xbt_mutex_acquire(mut);
 
-    if (!(async_small_thresh != 0 || (flags_ & RMA) !=0)) {
+    if (not(async_small_thresh != 0 || (flags_ & RMA) != 0)) {
       mailbox = process->mailbox();
     } else if (((flags_ & RMA) != 0) || static_cast<int>(size_) < async_small_thresh) { // eager mode
       mailbox = process->mailbox();
@@ -553,9 +553,9 @@ int Request::testany(int count, MPI_Request requests[], int *index, MPI_Status *
 
   std::vector<int> map; /** Maps all matching comms back to their location in requests **/
   for(i = 0; i < count; i++) {
-    if ((requests[i] != MPI_REQUEST_NULL) && requests[i]->action_ && !(requests[i]->flags_ & PREPARED)) {
-       comms.push_back(requests[i]->action_);
-       map.push_back(i);
+    if ((requests[i] != MPI_REQUEST_NULL) && requests[i]->action_ && not(requests[i]->flags_ & PREPARED)) {
+      comms.push_back(requests[i]->action_);
+      map.push_back(i);
     }
   }
   if (not map.empty()) {
@@ -591,7 +591,7 @@ int Request::testall(int count, MPI_Request requests[], MPI_Status status[])
   MPI_Status *pstat = status == MPI_STATUSES_IGNORE ? MPI_STATUS_IGNORE : &stat;
   int flag=1;
   for(int i=0; i<count; i++){
-    if (requests[i] != MPI_REQUEST_NULL && !(requests[i]->flags_ & PREPARED)) {
+    if (requests[i] != MPI_REQUEST_NULL && not(requests[i]->flags_ & PREPARED)) {
       if (test(&requests[i], pstat)!=1){
         flag=0;
       }else{
@@ -675,7 +675,7 @@ void Request::finish_wait(MPI_Request* request, MPI_Status * status)
   MPI_Request req = *request;
   Status::empty(status);
 
-  if(!((req->detached_ != 0) && ((req->flags_ & SEND) != 0)) && ((req->flags_ & PREPARED) == 0)){
+  if (not((req->detached_ != 0) && ((req->flags_ & SEND) != 0)) && ((req->flags_ & PREPARED) == 0)) {
     if(status != MPI_STATUS_IGNORE) {
       int src = req->src_ == MPI_ANY_SOURCE ? req->real_src_ : req->src_;
       status->MPI_SOURCE = req->comm_->group()->rank(src);
@@ -766,7 +766,8 @@ int Request::waitany(int count, MPI_Request requests[], MPI_Status * status)
     map = xbt_new(int, count);
     XBT_DEBUG("Wait for one of %d", count);
     for(i = 0; i < count; i++) {
-      if (requests[i] != MPI_REQUEST_NULL && !(requests[i]->flags_ & PREPARED) && !(requests[i]->flags_ & FINISHED)) {
+      if (requests[i] != MPI_REQUEST_NULL && not(requests[i]->flags_ & PREPARED) &&
+          not(requests[i]->flags_ & FINISHED)) {
         if (requests[i]->action_ != nullptr) {
           XBT_DEBUG("Waiting any %p ", requests[i]);
           xbt_dynar_push(&comms, &requests[i]->action_);
@@ -790,8 +791,8 @@ int Request::waitany(int count, MPI_Request requests[], MPI_Status * status)
       if (i != -1) {
         index = map[i];
         //in case of an accumulate, we have to wait the end of all requests to apply the operation, ordered correctly.
-        if ((requests[index] == MPI_REQUEST_NULL)
-             ||  (!((requests[index]->flags_ & ACCUMULATE) && (requests[index]->flags_ & RECV)))){
+        if ((requests[index] == MPI_REQUEST_NULL) ||
+            (not((requests[index]->flags_ & ACCUMULATE) && (requests[index]->flags_ & RECV)))) {
           finish_wait(&requests[index],status);
           if (requests[i] != MPI_REQUEST_NULL && (requests[i]->flags_ & NON_PERSISTENT))
             requests[index] = MPI_REQUEST_NULL;
index 0240e93..6ac1654 100644 (file)
@@ -84,7 +84,7 @@ Win::~Win(){
 }
 
 int Win::attach (void *base, MPI_Aint size){
-  if (!(base_ == MPI_BOTTOM || base_ == 0))
+  if (not(base_ == MPI_BOTTOM || base_ == 0))
     return MPI_ERR_ARG;
   base_=0;//actually the address will be given in the RMA calls, as being the disp.
   size_+=size;
@@ -573,8 +573,8 @@ int Win::lock(int lock_type, int rank, int assert){
     if(lock_type == MPI_LOCK_SHARED){//the window used to be exclusive, it's now shared.
       xbt_mutex_release(target_win->lock_mut_);
    }
-  } else if(!(target_win->mode_==MPI_LOCK_SHARED && lock_type == MPI_LOCK_EXCLUSIVE))
-        target_win->mode_+= lock_type; // don't set to exclusive if it's already shared
+  } else if (not(target_win->mode_ == MPI_LOCK_SHARED && lock_type == MPI_LOCK_EXCLUSIVE))
+    target_win->mode_ += lock_type; // don't set to exclusive if it's already shared
 
   target_win->lockers_.push_back(comm_->rank());
 
index 3555498..1b2582b 100644 (file)
@@ -33,7 +33,7 @@ void bottleneck_solve(lmm_system_t sys)
 
   static s_xbt_swag_t cnst_to_update;
 
-  if (!(sys->modified))
+  if (not sys->modified)
     return;
 
   /* Init */
index edc5cd4..e82b60f 100644 (file)
@@ -182,7 +182,7 @@ void lagrange_solve(lmm_system_t sys)
     lmm_print(sys);
   }
 
-  if (!(sys->modified))
+  if (not sys->modified)
     return;
 
   /* Initialize lambda. */
index f92f6e8..610e64a 100644 (file)
@@ -514,18 +514,18 @@ int lmm_get_number_of_cnst_from_var(lmm_system_t /*sys*/, lmm_variable_t var)
 
 lmm_variable_t lmm_get_var_from_cnst(lmm_system_t /*sys*/, lmm_constraint_t cnst, lmm_element_t * elem)
 {
-  if (!(*elem)) {
+  if (*elem == nullptr) {
     // That is the first call, pick the first element among enabled_element_set (or disabled_element_set if
     // enabled_element_set is empty)
     *elem = (lmm_element_t) xbt_swag_getFirst(&(cnst->enabled_element_set));
-    if (!(*elem))
+    if (*elem == nullptr)
       *elem = (lmm_element_t) xbt_swag_getFirst(&(cnst->disabled_element_set));
   } else {
     //elem is not null, so we carry on
     if(xbt_swag_belongs(*elem,&(cnst->enabled_element_set))){
       //Look at enabled_element_set, and jump to disabled_element_set when finished
       *elem = (lmm_element_t) xbt_swag_getNext(*elem, cnst->enabled_element_set.offset);
-      if (!(*elem))
+      if (*elem == nullptr)
         *elem = (lmm_element_t) xbt_swag_getFirst(&(cnst->disabled_element_set));
     } else {
       *elem = (lmm_element_t) xbt_swag_getNext(*elem, cnst->disabled_element_set.offset);      
@@ -542,10 +542,10 @@ lmm_variable_t lmm_get_var_from_cnst(lmm_system_t /*sys*/, lmm_constraint_t cnst
 lmm_variable_t lmm_get_var_from_cnst_safe(lmm_system_t /*sys*/, lmm_constraint_t cnst, lmm_element_t * elem,
                                           lmm_element_t * nextelem, int * numelem)
 {
-  if (!(*elem)){
+  if (*elem == nullptr) {
     *elem = (lmm_element_t) xbt_swag_getFirst(&(cnst->enabled_element_set));
     *numelem = xbt_swag_size(&(cnst->enabled_element_set))+xbt_swag_size(&(cnst->disabled_element_set))-1;
-    if (!(*elem))
+    if (*elem == nullptr)
       *elem = (lmm_element_t) xbt_swag_getFirst(&(cnst->disabled_element_set));
   }else{
     *elem = *nextelem;
@@ -559,7 +559,7 @@ lmm_variable_t lmm_get_var_from_cnst_safe(lmm_system_t /*sys*/, lmm_constraint_t
     if(xbt_swag_belongs(*elem,&(cnst->enabled_element_set))){
       //Look at enabled_element_set, and jump to disabled_element_set when finished
       *nextelem = (lmm_element_t) xbt_swag_getNext(*elem, cnst->enabled_element_set.offset);
-      if (!(*nextelem))
+      if (*nextelem == nullptr)
         *nextelem = (lmm_element_t) xbt_swag_getFirst(&(cnst->disabled_element_set));
     } else {
       *nextelem = (lmm_element_t) xbt_swag_getNext(*elem, cnst->disabled_element_set.offset);      
@@ -716,7 +716,7 @@ void lmm_solve(lmm_system_t sys)
   double min_usage = -1;
   double min_bound = -1;
 
-  if (!(sys->modified))
+  if (not sys->modified)
     return;
 
   XBT_IN("(sys=%p)", sys);
index 7d3aa5a..1f204a7 100644 (file)
@@ -234,7 +234,7 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta)
           double_update(&(deltap), action->latency_, sg_surf_precision);
           action->latency_ = 0.0;
         }
-        if (action->latency_ <= 0.0 && !(action->isSuspended()))
+        if (action->latency_ <= 0.0 && not action->isSuspended())
           lmm_update_variable_weight(maxminSystem_, action->getVariable(), action->weight_);
       }
       if (TRACE_is_enabled()) {
index de50cac..d78d4de 100644 (file)
@@ -59,7 +59,7 @@ public:
   explicit DatedValue() = default;
   explicit DatedValue(double d, double v) : date_(d), value_(v) {}
   bool operator==(DatedValue e2);
-  bool operator!=(DatedValue e2) { return !(*this == e2); }
+  bool operator!=(DatedValue e2) { return not(*this == e2); }
 };
 std::ostream& operator<<(std::ostream& out, const DatedValue& e);
 
index 8dadf6b..f5759cf 100644 (file)
@@ -119,7 +119,7 @@ static void xbt_dict_rehash(xbt_dict_t dict)
   XBT_DEBUG("REHASH (%d->%d)", oldsize, newsize);
 
   for (unsigned i = 0; i < oldsize; i++, currcell++) {
-    if (!*currcell)             /* empty cell */
+    if (*currcell == nullptr) /* empty cell */
       continue;
 
     xbt_dictelm_t *twincell = currcell + oldsize;
@@ -132,7 +132,7 @@ static void xbt_dict_rehash(xbt_dict_t dict)
       if ((bucklet->hash_code & newsize) != i) {        /* Move to b */
         *pprev = bucklet->next;
         bucklet->next = *twincell;
-        if (!*twincell)
+        if (*twincell == nullptr)
           dict->fill++;
         *twincell = bucklet;
       } else {
@@ -140,7 +140,7 @@ static void xbt_dict_rehash(xbt_dict_t dict)
       }
     }
 
-    if (!*currcell)             /* everything moved */
+    if (*currcell == nullptr) /* everything moved */
       dict->fill--;
   }
 }
@@ -938,7 +938,6 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test")
   xbt_dict_t head = xbt_dict_new_homogeneous(&free);
   xbt_test_add("Fill %d elements, with keys being the number of element", NB_ELM);
   for (int j = 0; j < NB_ELM; j++) {
-    /* if (!(j%1000)) { printf("."); fflush(stdout); } */
     char* key = (char*)xbt_malloc(10);
 
     snprintf(key,10, "%d", j);
@@ -966,7 +965,6 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test")
   xbt_test_add("Remove my %d elements", NB_ELM);
   key = (char*) xbt_malloc(10);
   for (int j = 0; j < NB_ELM; j++) {
-    /* if (!(j%10000)) printf("."); fflush(stdout); */
     snprintf(key,10, "%d", j);
     xbt_dict_remove(head, key);
   }
index 37f1c25..9115b40 100644 (file)
@@ -227,7 +227,7 @@ XBT_TEST_UNIT("cleanup", test_cleanup, "cleanup handling")
     c = 1;
     if (v1 != 5678)
       xbt_test_fail("v1 = %d (!= 5678)", v1);
-    if (!(ex.category == 1 && ex.value == 2 && not strcmp(ex.what(), "blah")))
+    if (not(ex.category == 1 && ex.value == 2 && not strcmp(ex.what(), "blah")))
       xbt_test_fail("unexpected exception contents");
   }
   if (not c)