I have a short patch for gri_glfsr.h. I haven't filled out a copyright
form but this is very short so hopefully it won't be an issue.

Description of bug:

In file gnuradio-core/src/lib/general/gri_glfsr.h, the variable
d_shift_register is declared as a signed integer. When right shifted in
function next_bit(), this produces an arithmetic instead of a logical
shift, which gives incorrect results. Fixed by making d_shift_register and
d_mask unsigned integers.

Also in this file, the constructor should use an initialization list to
initialize the member variables.

ChangeLog entry:

Changed d_shift_register and d_mask from signed to unsigned. Moved member
variable initialization from constructor body to initialization list.

Patch is attached.

Eudean

--- gri_glfsr.h 2010-09-02 19:12:55.574534300 -0700
+++ gri_glfsr_rev.h     2010-09-02 19:14:32.573913500 -0700
@@ -32,12 +32,12 @@
 class gri_glfsr
 {
  private:
-  int d_shift_register;
-  int d_mask;
+  unsigned int d_shift_register;
+  unsigned int d_mask;
 
  public:
 
-  gri_glfsr(int mask, int seed) { d_shift_register = seed; d_mask = mask; }
+  gri_glfsr(int mask, int seed) : d_shift_register(seed), d_mask(mask) {}
   static int glfsr_mask(int degree);
 
   unsigned char next_bit() {
_______________________________________________
Patch-gnuradio mailing list
Patch-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/patch-gnuradio

Reply via email to