discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] digital_correlate_access_code_bb


From: Marcus D. Leech
Subject: [Discuss-gnuradio] digital_correlate_access_code_bb
Date: Sat, 07 Apr 2012 22:12:49 -0400
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16

Just looking at this function:

correlate_access_code_bb

In the method set_access_code, it takes a string. Which should be ASCII '1' and '0' characters to represent the binary sequence being
  correlated against.

Here's a little beauty of a code snippet:

 d_access_code = 0;
  for (unsigned i=0; i < 64; i++){
    d_access_code <<= 1;
    if (i < len)
      d_access_code |= access_code[i] & 1;    // look at LSB only
  }

This relies on the fact that ASCII '1' and '0' happen to have low-order bits of the right "flavour". This is insanely dirty and gross and I can't
  believe we let this nonsense in the code base.

There's no reason not to do the right thing here.


--
Marcus Leech
Principal Investigator
Shirleys Bay Radio Astronomy Consortium
http://www.sbrac.org





reply via email to

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