commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 04/24: Simplify some more.


From: git
Subject: [Commit-gnuradio] [gnuradio] 04/24: Simplify some more.
Date: Tue, 18 Mar 2014 17:51:40 +0000 (UTC)

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

trondeau pushed a commit to branch master
in repository gnuradio.

commit 782cf95222982a204b2447827e32d381eb97ff2b
Author: Nick Foster <address@hidden>
Date:   Thu Mar 13 10:48:06 2014 -0700

    Simplify some more.
---
 gr-digital/lib/correlate_access_code_tag_bb_impl.cc | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/gr-digital/lib/correlate_access_code_tag_bb_impl.cc 
b/gr-digital/lib/correlate_access_code_tag_bb_impl.cc
index 478dadc..f976676 100644
--- a/gr-digital/lib/correlate_access_code_tag_bb_impl.cc
+++ b/gr-digital/lib/correlate_access_code_tag_bb_impl.cc
@@ -86,8 +86,8 @@ namespace gr {
         d_access_code = (d_access_code << 1) | (access_code[i] & 1);
       }
       if(VERBOSE) {
-          std::cout << "Access code: " << std::hex << d_access_code << 
std::dec << std::endl;
-          std::cout << "Mask: " << std::hex << d_mask << std::dec << std::endl;
+          std::cerr << "Access code: " << std::hex << d_access_code << 
std::dec << std::endl;
+          std::cerr << "Mask: " << std::hex << d_mask << std::dec << std::endl;
       }
 
       return true;
@@ -103,38 +103,31 @@ namespace gr {
 
       uint64_t abs_out_sample_cnt = nitems_written(0);
 
-      int size = noutput_items-d_len;
-      if(size<=0) return 0;
-
-      for(int i = 0; i < size; i++) {
+      for(int i = 0; i < noutput_items; i++) {
        out[i] = in[i];
 
        // compute hamming distance between desired access code and current data
        uint64_t wrong_bits = 0;
        uint64_t nwrong = d_threshold+1;
-       int new_flag = 0;
 
        wrong_bits  = (d_data_reg ^ d_access_code) & d_mask;
        volk_64u_popcnt(&nwrong, wrong_bits);
 
-       // test for access code with up to threshold errors
-       new_flag = (nwrong <= d_threshold);
-
        // shift in new data and new flag
        d_data_reg = (d_data_reg << 1) | (in[i] & 0x1);
-       if(new_flag) {
+       if(nwrong <= d_threshold) {
          if(VERBOSE)
            std::cerr << "writing tag at sample " << abs_out_sample_cnt + i << 
std::endl;
          add_item_tag(0, //stream ID
                       abs_out_sample_cnt + i, //sample
                       d_key,      //frame info
-                      pmt::from_long(nwrong), //data (unused)
+                      pmt::from_long(nwrong), //data (number wrong)
                       d_me        //block src id
                       );
        }
       }
 
-      return size;
+      return noutput_items;
     }
 
   } /* namespace digital */



reply via email to

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