commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 02/03: Removing use of 'and', 'or', and 'no


From: git
Subject: [Commit-gnuradio] [gnuradio] 02/03: Removing use of 'and', 'or', and 'not' for &&, ||, and !.
Date: Mon, 6 Oct 2014 16:26:27 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

trondeau pushed a commit to branch maint
in repository gnuradio.

commit 81839787238b9d2b9ffb65c58fccf1ae861c80ff
Author: Tom Rondeau <address@hidden>
Date:   Mon Oct 6 09:25:59 2014 -0400

    Removing use of 'and', 'or', and 'not' for &&, ||, and !.
---
 gr-blocks/lib/multiply_matrix_cc_impl.cc | 19 +++++++++----------
 gr-blocks/lib/multiply_matrix_ff_impl.cc | 19 +++++++++----------
 gr-uhd/lib/usrp_sink_impl.cc             | 16 ++++++++--------
 gr-uhd/lib/usrp_source_impl.cc           |  4 ++--
 4 files changed, 28 insertions(+), 30 deletions(-)

diff --git a/gr-blocks/lib/multiply_matrix_cc_impl.cc 
b/gr-blocks/lib/multiply_matrix_cc_impl.cc
index f9fc30e..55f2262 100644
--- a/gr-blocks/lib/multiply_matrix_cc_impl.cc
+++ b/gr-blocks/lib/multiply_matrix_cc_impl.cc
@@ -1,19 +1,19 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2014 Free Software Foundation, Inc.
- * 
+ *
  * This file is part of GNU Radio
- * 
+ *
  * GNU Radio is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * GNU Radio is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with GNU Radio; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -34,7 +34,7 @@ namespace gr {
     multiply_matrix_cc::sptr
     multiply_matrix_cc::make(std::vector<std::vector<gr_complex> > A, 
gr::block::tag_propagation_policy_t tag_propagation_policy)
     {
-      if (A.empty() or A[0].size() == 0) {
+      if (A.empty() || A[0].size() == 0) {
         throw std::invalid_argument("matrix A has invalid dimensions.");
       }
       return gnuradio::get_initial_sptr
@@ -134,11 +134,11 @@ namespace gr {
     void
     multiply_matrix_cc_impl::msg_handler_A(pmt::pmt_t A)
     {
-      if (not pmt::is_vector(A) and not pmt::is_tuple(A)) {
+      if (!pmt::is_vector(A) && !pmt::is_tuple(A)) {
           GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong type).");
           return;
       }
-      if (not pmt::length(A) == d_A.size()) {
+      if (!pmt::length(A) == d_A.size()) {
           GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong size).");
           return;
       }
@@ -151,7 +151,7 @@ namespace gr {
         } else if (pmt::is_tuple(A)) {
           row = pmt::tuple_ref(A, i);
         }
-        if (pmt::is_vector(row) or pmt::is_tuple(row)) {
+        if (pmt::is_vector(row) || pmt::is_tuple(row)) {
           if (pmt::length(row) != d_A[0].size()) {
             GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong number of 
columns).");
             return;
@@ -189,4 +189,3 @@ namespace gr {
 
   } /* namespace blocks */
 } /* namespace gr */
-
diff --git a/gr-blocks/lib/multiply_matrix_ff_impl.cc 
b/gr-blocks/lib/multiply_matrix_ff_impl.cc
index 564e673..808e0ce 100644
--- a/gr-blocks/lib/multiply_matrix_ff_impl.cc
+++ b/gr-blocks/lib/multiply_matrix_ff_impl.cc
@@ -1,19 +1,19 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2014 Free Software Foundation, Inc.
- * 
+ *
  * This file is part of GNU Radio
- * 
+ *
  * GNU Radio is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * GNU Radio is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with GNU Radio; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -34,7 +34,7 @@ namespace gr {
     multiply_matrix_ff::sptr
     multiply_matrix_ff::make(std::vector<std::vector<float> > A, 
gr::block::tag_propagation_policy_t tag_propagation_policy)
     {
-      if (A.empty() or A[0].size() == 0) {
+      if (A.empty() || A[0].size() == 0) {
         throw std::invalid_argument("matrix A has invalid dimensions.");
       }
       return gnuradio::get_initial_sptr
@@ -134,11 +134,11 @@ namespace gr {
     void
     multiply_matrix_ff_impl::msg_handler_A(pmt::pmt_t A)
     {
-      if (not pmt::is_vector(A) and not pmt::is_tuple(A)) {
+      if (!pmt::is_vector(A) && !pmt::is_tuple(A)) {
           GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong type).");
           return;
       }
-      if (not pmt::length(A) == d_A.size()) {
+      if (!pmt::length(A) == d_A.size()) {
           GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong size).");
           return;
       }
@@ -151,7 +151,7 @@ namespace gr {
         } else if (pmt::is_tuple(A)) {
           row = pmt::tuple_ref(A, i);
         }
-        if (pmt::is_vector(row) or pmt::is_tuple(row)) {
+        if (pmt::is_vector(row) || pmt::is_tuple(row)) {
           if (pmt::length(row) != d_A[0].size()) {
             GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong number of 
columns).");
             return;
@@ -189,4 +189,3 @@ namespace gr {
 
   } /* namespace blocks */
 } /* namespace gr */
-
diff --git a/gr-uhd/lib/usrp_sink_impl.cc b/gr-uhd/lib/usrp_sink_impl.cc
index 20f6fd6..1a17e87 100644
--- a/gr-uhd/lib/usrp_sink_impl.cc
+++ b/gr-uhd/lib/usrp_sink_impl.cc
@@ -589,7 +589,7 @@ namespace gr {
 #endif
 
       //if using length_tags, decrement items left to send by the number of 
samples sent
-      if(not pmt::is_null(_length_tag_key) and _nitems_to_send > 0) {
+      if(not pmt::is_null(_length_tag_key) && _nitems_to_send > 0) {
         _nitems_to_send -= long(num_sent);
       }
 
@@ -597,7 +597,7 @@ namespace gr {
       _metadata.time_spec += ::uhd::time_spec_t(0, num_sent, _sample_rate);
 
       // Some post-processing tasks if we actually transmitted the entire burst
-      if (not _pending_cmds.empty() and num_sent == size_t(ninput_items)) {
+      if (not _pending_cmds.empty() && num_sent == size_t(ninput_items)) {
         GR_LOG_DEBUG(d_debug_logger, boost::format("Executing %d pending 
commands.") % _pending_cmds.size());
         BOOST_FOREACH(const pmt::pmt_t &cmd_pmt, _pending_cmds) {
           msg_handler_command(cmd_pmt);
@@ -669,7 +669,7 @@ namespace gr {
         }
 
         //set the start of burst flag in the metadata; ignore if 
length_tag_key is not null
-        else if(pmt::is_null(_length_tag_key) and pmt::equal(key, SOB_KEY)) {
+        else if(pmt::is_null(_length_tag_key) && pmt::equal(key, SOB_KEY)) {
           if (my_tag.offset != samp0_count) {
             max_count = my_tag_count;
             break;
@@ -680,7 +680,7 @@ namespace gr {
         }
 
         //length_tag found; set the start of burst flag in the metadata
-        else if(not pmt::is_null(_length_tag_key) and pmt::equal(key, 
_length_tag_key)) {
+        else if(not pmt::is_null(_length_tag_key) && pmt::equal(key, 
_length_tag_key)) {
           if (my_tag_count != samp0_count) {
             max_count = my_tag_count;
             break;
@@ -704,7 +704,7 @@ namespace gr {
          * the appropriate action. Otherwise, make sure the corresponding 
sample
          * is the last one.
          */
-        else if (pmt::equal(key, FREQ_KEY) and my_tag_count == samp0_count) {
+        else if (pmt::equal(key, FREQ_KEY) && my_tag_count == samp0_count) {
           // If it's on the first sample, immediately do the tune:
           GR_LOG_DEBUG(d_debug_logger, boost::format("Received tx_freq on 
start of burst."));
           msg_handler_command(pmt::cons(pmt::mp("freq"), value));
@@ -724,14 +724,14 @@ namespace gr {
          *
          * Make sure that no more samples are allowed through.
          */
-        else if(pmt::is_null(_length_tag_key) and pmt::equal(key, EOB_KEY)) {
+        else if(pmt::is_null(_length_tag_key) && pmt::equal(key, EOB_KEY)) {
           found_eob = true;
           max_count = my_tag_count + 1;
           _metadata.end_of_burst = pmt::to_bool(value);
         }
       } // end foreach
 
-      if(not pmt::is_null(_length_tag_key) and long(max_count - samp0_count) 
== _nitems_to_send) {
+      if(not pmt::is_null(_length_tag_key) && long(max_count - samp0_count) == 
_nitems_to_send) {
         found_eob = true;
       }
 
@@ -782,7 +782,7 @@ namespace gr {
       _metadata.start_of_burst = true;
       _metadata.end_of_burst = false;
       // Bursty tx will need to send a tx_time to activate time spec
-      _metadata.has_time_spec = not _stream_now and 
pmt::is_null(_length_tag_key);
+      _metadata.has_time_spec = !_stream_now && pmt::is_null(_length_tag_key);
       _nitems_to_send = 0;
       if(_start_time_set) {
         _start_time_set = false; //cleared for next run
diff --git a/gr-uhd/lib/usrp_source_impl.cc b/gr-uhd/lib/usrp_source_impl.cc
index 53038bf..6be0bac 100644
--- a/gr-uhd/lib/usrp_source_impl.cc
+++ b/gr-uhd/lib/usrp_source_impl.cc
@@ -723,7 +723,7 @@ namespace gr {
       if (command == "freq") {
        double freq = pmt::to_double(cmd_value);
        for (size_t i = 0; i < _nchan; i++) {
-         if (chan == -1 or chan == int(i)) {
+         if (chan == -1 || chan == int(i)) {
            set_center_freq(freq, i);
          }
        }
@@ -733,7 +733,7 @@ namespace gr {
       } else if (command == "gain") {
        double gain = pmt::to_double(cmd_value);
        for (size_t i = 0; i < _nchan; i++) {
-         if (chan == -1 or chan == int(i)) {
+         if (chan == -1 || chan == int(i)) {
            set_gain(gain, i);
          }
        }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]