commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] gr-error-correcting-codes/src/lib ecc_syms_to_m...


From: Michael Dickens
Subject: [Commit-gnuradio] gr-error-correcting-codes/src/lib ecc_syms_to_m...
Date: Wed, 02 Aug 2006 01:28:44 +0000

CVSROOT:        /sources/gnuradio
Module name:    gr-error-correcting-codes
Changes by:     Michael Dickens <michaelld>     06/08/02 01:28:44

Modified files:
        src/lib        : ecc_syms_to_metrics.cc ecc_syms_to_metrics.h 
        src/lib/libecc : code_convolutional_trellis.cc code_metrics.cc 
                         code_metrics.h 
        src/lib/libecc/mld: n2bs.cc n2bs.h 

Log message:
        Hopefully fixed compile errors.
        
        Changed the code_metrics creation to a separate (non-static) function.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc?cvsroot=gnuradio&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h?cvsroot=gnuradio&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/code_convolutional_trellis.cc?cvsroot=gnuradio&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/code_metrics.cc?cvsroot=gnuradio&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/code_metrics.h?cvsroot=gnuradio&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/mld/n2bs.cc?cvsroot=gnuradio&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/mld/n2bs.h?cvsroot=gnuradio&r1=1.1&r2=1.2

Patches:
Index: ecc_syms_to_metrics.cc
===================================================================
RCS file: 
/sources/gnuradio/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ecc_syms_to_metrics.cc      1 Aug 2006 19:02:35 -0000       1.1
+++ ecc_syms_to_metrics.cc      2 Aug 2006 01:28:44 -0000       1.2
@@ -84,7 +84,8 @@
   // use the static "create" member function to create the actual
   // code_metrics to use.
 
-  d_code_metrics = code_metrics<float>::create (&pdf_fcn_0,
+  d_code_metrics_table = libecc_code_metrics_create_table<float>
+    (&pdf_fcn_0,
                                                &pdf_fcn_1,
                                                n_samples,
                                                min_sample,
@@ -93,7 +94,7 @@
 
   // get the output item size in bytes from the new code_metrics.
 
-  d_out_item_size_bytes = d_code_metrics->out_item_size_bytes ();
+  d_out_item_size_bytes = d_code_metrics_table->out_item_size_bytes ();
 
   // set the output signature to match that which the code_metrics
   // will generate.
@@ -135,7 +136,7 @@
     void* t_out_buf_0_bit = (void*)(&(output_items[2*n]));
     void* t_out_buf_1_bit = (void*)(&(output_items[(2*n)+1]));
 
-    d_code_metrics->convert (l_n_output_items, t_in_buf,
+    d_code_metrics_table->convert (l_n_output_items, t_in_buf,
                             t_out_buf_0_bit, t_out_buf_1_bit);
   }
 

Index: ecc_syms_to_metrics.h
===================================================================
RCS file: 
/sources/gnuradio/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ecc_syms_to_metrics.h       1 Aug 2006 19:02:35 -0000       1.1
+++ ecc_syms_to_metrics.h       2 Aug 2006 01:28:44 -0000       1.2
@@ -51,6 +51,7 @@
 
 class ecc_syms_to_metrics : public gr_block
 {
+protected:
   friend ecc_syms_to_metrics_sptr
   ecc_make_syms_to_metrics (gr_feval_ff* pdf_fcn_0_bit,
                            gr_feval_ff* pdf_fcn_1_bit,
@@ -105,12 +106,10 @@
                       int sample_precision);
 
   size_t d_out_item_size_bytes;
-  code_metrics<float>* d_code_metrics;
+  code_metrics_table<float>* d_code_metrics_table;
 
 public:
-  inline ~ecc_syms_to_metrics() {
-    delete d_code_metrics;
-  };
+  ~ecc_syms_to_metrics() {delete d_code_metrics_table;};
 
   bool check_topology (int ninputs, int noutputs);
 

Index: libecc/code_convolutional_trellis.cc
===================================================================
RCS file: 
/sources/gnuradio/gr-error-correcting-codes/src/lib/libecc/code_convolutional_trellis.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libecc/code_convolutional_trellis.cc        1 Aug 2006 19:02:35 -0000       
1.2
+++ libecc/code_convolutional_trellis.cc        2 Aug 2006 01:28:44 -0000       
1.3
@@ -285,7 +285,8 @@
 
   // store the parameters for SOAI
 
-  std::vector<size_t> t_fb_generators_soai, t_n_delays_soai, t_io_num_soai;
+  std::vector<memory_t> t_fb_generators_soai;
+  std::vector<size_t>  t_n_delays_soai, t_io_num_soai;
   std::vector<size_t> t_states_ndx_soai;
   size_t t_max_delay_soai, t_total_n_delays_soai, t_n_memories_soai;
 

Index: libecc/code_metrics.cc
===================================================================
RCS file: 
/sources/gnuradio/gr-error-correcting-codes/src/lib/libecc/code_metrics.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- libecc/code_metrics.cc      1 Aug 2006 19:02:35 -0000       1.5
+++ libecc/code_metrics.cc      2 Aug 2006 01:28:44 -0000       1.6
@@ -30,46 +30,46 @@
 #include <assert.h>
 
 template<typename pdf_fcn_io_t>
-code_metrics<pdf_fcn_io_t>*
-code_metrics<pdf_fcn_io_t>::create
-(pdf_fcn_t pdf_fcn_0_bit,
- pdf_fcn_t pdf_fcn_1_bit,
+code_metrics_table<pdf_fcn_io_t>*
+libecc_code_metrics_create_table
+(pdf_fcn_io_t (*pdf_fcn_0_bit) (pdf_fcn_io_t),
+ pdf_fcn_io_t (*pdf_fcn_1_bit) (pdf_fcn_io_t),
  size_t n_samples,
  pdf_fcn_io_t min_sample,
  pdf_fcn_io_t max_sample,
  int sample_precision)
 {
   if (! pdf_fcn_0_bit) {
-    std::cerr << "code_metrics_table::create: Error: pdf_fcn_0_bit must be "
-            "a non-null pointer to function.\n";
+    std::cerr << "libecc_code_metrics_create_table: Error: "
+      "pdf_fcn_0_bit must be a non-null pointer to function.\n";
     assert (0);
   }
   if (! pdf_fcn_1_bit) {
-    std::cerr << "code_metrics_table::create: Error: pdf_fcn_0_bit must be "
-            "a non-null pointer to function.\n";
+    std::cerr << "libecc_code_metrics_create_table: Error: "
+      "pdf_fcn_0_bit must be a non-null pointer to function.\n";
     assert (0);
   }
   if (n_samples < 2) {
-    std::cerr << "code_metrics_table::create: Error: n_samples "
-            "must be at least 2.\n";
+    std::cerr << "libecc_code_metrics_create_table: Error: "
+      "n_samples must be at least 2.\n";
     assert (0);
   }
   if (min_sample >= max_sample) {
-    std::cerr << "code_metrics_table::create: Error: min_sample must be "
-            "less than max_sample.\n";
+    std::cerr << "libecc_code_metrics_create_table: Error: "
+      "min_sample must be less than max_sample.\n";
     assert (0);
   }
   if ((sample_precision < 0) | (sample_precision > 32)) {
-    std::cerr << "code_metrics_table::create: Error: sample_precision "
-      "must be between 0 and 32.\n";
+    std::cerr << "libecc_code_metrics_create_table: Error: "
+      "sample_precision must be between 0 and 32.\n";
     assert (0);
   }
 
-  code_metrics<pdf_fcn_io_t>* t_code_metrics;
+  code_metrics_table<pdf_fcn_io_t>* t_code_metrics_table;
 
   if (sample_precision == 0) {
     // float
-    t_code_metrics = new code_metric_table
+    t_code_metrics_table = new code_metrics_table_work
       <pdf_fcn_io_t, float>(pdf_fcn_0_bit,
                            pdf_fcn_1_bit,
                            n_samples,
@@ -77,7 +77,7 @@
                            max_sample);
   } else if (sample_precision <= 8) {
     // use char
-    t_code_metrics = new code_metric_table
+    t_code_metrics_table = new code_metrics_table_work
       <pdf_fcn_io_t, unsigned char>(pdf_fcn_0_bit,
                                    pdf_fcn_1_bit,
                                    n_samples,
@@ -86,7 +86,7 @@
                                    sample_precision);
   } else if (sample_precision <= 16) {
     // use short
-    t_code_metrics = new code_metric_table
+    t_code_metrics_table = new code_metrics_table_work
       <pdf_fcn_io_t, unsigned short>(pdf_fcn_0_bit,
                                     pdf_fcn_1_bit,
                                     n_samples,
@@ -95,7 +95,7 @@
                                     sample_precision);
   } else {
     // use long
-    t_code_metrics = new code_metric_table
+    t_code_metrics_table = new code_metrics_table_work
       <pdf_fcn_io_t, unsigned long>(pdf_fcn_0_bit,
                                    pdf_fcn_1_bit,
                                    n_samples,
@@ -104,11 +104,11 @@
                                    sample_precision);
   }
 
-  return (t_code_metrics);
+  return (t_code_metrics_table);
 }
 
 template<typename pdf_fcn_io_t>
-code_metrics<pdf_fcn_io_t>::code_metrics
+code_metrics_table<pdf_fcn_io_t>::code_metrics_table
 (pdf_fcn_t pdf_fcn_0_bit,
  pdf_fcn_t pdf_fcn_1_bit,
  size_t n_samples,
@@ -229,22 +229,22 @@
 }
 
 template<typename pdf_fcn_io_t, typename metric_t>
-code_metric_table<pdf_fcn_io_t,metric_t>::code_metric_table
+code_metrics_table_work<pdf_fcn_io_t,metric_t>::code_metrics_table_work
 (pdf_fcn_t pdf_fcn_0_bit,
  pdf_fcn_t pdf_fcn_1_bit,
  size_t n_samples,
  pdf_fcn_io_t min_sample,
  pdf_fcn_io_t max_sample,
  int sample_precision)
-  : code_metrics<pdf_fcn_io_t>
+  : code_metrics_table<pdf_fcn_io_t>
     (pdf_fcn_0_bit,
      pdf_fcn_1_bit,
      n_samples,
      min_sample,
      max_sample)
 {
-  code_metrics<pdf_fcn_io_t>::d_out_item_size_bytes = sizeof (metric_t);
-  code_metrics<pdf_fcn_io_t>::d_sample_precision = sample_precision;
+  code_metrics_table<pdf_fcn_io_t>::d_out_item_size_bytes = sizeof (metric_t);
+  code_metrics_table<pdf_fcn_io_t>::d_sample_precision = sample_precision;
 
   // get the scale factor for converting from float to
   // sample_precision maps: 0 -> 0, 1 -> (2^sample_precision)-1 for
@@ -259,31 +259,31 @@
   d_metric_table_0_bit.assign (n_samples, 0);
   for (size_t m = 0; m < n_samples; m++) {
     d_metric_table_0_bit[m] =
-      (metric_t)((code_metrics<pdf_fcn_io_t>::d_pdf_fcn_0_samples[m]) *
+      (metric_t)((code_metrics_table<pdf_fcn_io_t>::d_pdf_fcn_0_samples[m]) *
                 t_mult);
   }
 
   // clear the old float sample vectors to free memory
 
-  code_metrics<pdf_fcn_io_t>::d_pdf_fcn_0_samples.resize (0);
+  code_metrics_table<pdf_fcn_io_t>::d_pdf_fcn_0_samples.resize (0);
 
   // convert the 1 bit metrics from float to integer
 
   d_metric_table_1_bit.assign (n_samples, 0);
   for (size_t m = 0; m < n_samples; m++) {
     d_metric_table_1_bit[m] =
-      (metric_t)((code_metrics<pdf_fcn_io_t>::d_pdf_fcn_1_samples[m]) *
+      (metric_t)((code_metrics_table<pdf_fcn_io_t>::d_pdf_fcn_1_samples[m]) *
                 t_mult);
   }
 
   // clear the old float sample vectors to free memory
 
-  code_metrics<pdf_fcn_io_t>::d_pdf_fcn_1_samples.resize (0);
+  code_metrics_table<pdf_fcn_io_t>::d_pdf_fcn_1_samples.resize (0);
 }
 
 template<typename pdf_fcn_io_t, typename metric_t>
 void
-code_metric_table<pdf_fcn_io_t,metric_t>::lookup
+code_metrics_table_work<pdf_fcn_io_t,metric_t>::lookup
 (pdf_fcn_io_t sym,
  void* bit_0,
  void* bit_1)
@@ -291,27 +291,27 @@
   metric_ptr_t l_bit_0 = (metric_ptr_t) bit_0;
   metric_ptr_t l_bit_1 = (metric_ptr_t) bit_1;
 
-  if (sym <= code_metrics<pdf_fcn_io_t>::d_min_sample) {
+  if (sym <= code_metrics_table<pdf_fcn_io_t>::d_min_sample) {
     *l_bit_0 = d_metric_table_0_bit[0];
     *l_bit_1 = d_metric_table_1_bit[0];
     return;
   }
-  if (sym >= code_metrics<pdf_fcn_io_t>::d_max_sample) {
+  if (sym >= code_metrics_table<pdf_fcn_io_t>::d_max_sample) {
     *l_bit_0 = d_metric_table_0_bit.back ();
     *l_bit_1 = d_metric_table_1_bit.back ();
     return;
   }
 
   size_t l_ndx = (size_t) round
-    ((double)((sym - code_metrics<pdf_fcn_io_t>::d_min_sample) /
-             code_metrics<pdf_fcn_io_t>::d_delta));
+    ((double)((sym - code_metrics_table<pdf_fcn_io_t>::d_min_sample) /
+             code_metrics_table<pdf_fcn_io_t>::d_delta));
   *l_bit_0 = d_metric_table_0_bit[l_ndx];
   *l_bit_1 = d_metric_table_1_bit[l_ndx];
 }
 
 template<typename pdf_fcn_io_t, typename metric_t>
 void
-code_metric_table<pdf_fcn_io_t,metric_t>::convert
+code_metrics_table_work<pdf_fcn_io_t,metric_t>::convert
 (size_t n_syms,
  pdf_fcn_io_t* sym,
  void* bit_0,

Index: libecc/code_metrics.h
===================================================================
RCS file: 
/sources/gnuradio/gr-error-correcting-codes/src/lib/libecc/code_metrics.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- libecc/code_metrics.h       1 Aug 2006 19:02:35 -0000       1.4
+++ libecc/code_metrics.h       2 Aug 2006 01:28:44 -0000       1.5
@@ -27,7 +27,31 @@
 #include <vector>
 
 template<typename pdf_fcn_io_t>
-class code_metrics
+class code_metrics_table;
+
+template<typename pdf_fcn_io_t>
+code_metrics_table<pdf_fcn_io_t>*
+libecc_code_metrics_create_table
+(pdf_fcn_io_t (*pdf_fcn_0_bit) (pdf_fcn_io_t),
+ pdf_fcn_io_t (*pdf_fcn_1_bit) (pdf_fcn_io_t),
+ size_t n_samples,
+ pdf_fcn_io_t min_sample,
+ pdf_fcn_io_t max_sample,
+ int sample_precision = 0);
+
+#if 0
+template<typename pdf_fcn_io_t>
+class code_metrics_decoder;
+
+template<typename pdf_fcn_io_t>
+libecc_code_metrics_create_decoder
+(code_convolutional_trellis* trellis,
+ code_metrics_table<pdf_fcn_io_t>* table = 0,
+ int sample_precision = 0);
+#endif
+
+template<typename pdf_fcn_io_t>
+class code_metrics_table
 {
 /*
  * class code_metrics_table: metrics table for convolutional codes.
@@ -73,7 +97,7 @@
 public:
   typedef pdf_fcn_io_t (*pdf_fcn_t) (pdf_fcn_io_t);
 
-  virtual ~code_metrics () {};
+  virtual ~code_metrics_table () {};
 
   // lookup() returns either a float, or a sign-extended
   // 'sample_precision'-bit integer value.
@@ -92,19 +116,8 @@
   inline const unsigned char out_item_size_bytes ()
   {return(d_out_item_size_bytes);};
 
-  // code_metrics are not "new"d directly, but rather created by this
-  // static function - which automatically determines the correct
-  // storage class type and creates the new instantiation.
-
-  static code_metrics* create (pdf_fcn_t pdf_fcn_0_bit,
-                              pdf_fcn_t pdf_fcn_1_bit,
-                              size_t n_samples,
-                              pdf_fcn_io_t min_sample,
-                              pdf_fcn_io_t max_sample,
-                              int sample_precision = 0);
-
 protected:
-  code_metrics (pdf_fcn_t pdf_fcn_0_bit,
+  code_metrics_table (pdf_fcn_t pdf_fcn_0_bit,
                pdf_fcn_t pdf_fcn_1_bit,
                size_t n_samples,
                pdf_fcn_io_t min_sample,
@@ -118,29 +131,29 @@
 };
 
 template<typename pdf_fcn_io_t, typename metric_t>
-class code_metric_table : public code_metrics<pdf_fcn_io_t>
+class code_metrics_table_work : public code_metrics_table<pdf_fcn_io_t>
 {
 public:
   typedef metric_t *metric_ptr_t;
   typedef pdf_fcn_io_t (*pdf_fcn_t) (pdf_fcn_io_t);
 
-  ~code_metric_table () {};
+  ~code_metrics_table_work () {};
 
   void lookup (pdf_fcn_io_t sym, void* bit_0, void* bit_1);
   void convert (size_t n_syms, pdf_fcn_io_t* sym, void* bit_0, void* bit_1);
 
 protected:
-  code_metric_table (pdf_fcn_t pdf_fcn_0_bit,
+  code_metrics_table_work (pdf_fcn_t pdf_fcn_0_bit,
                     pdf_fcn_t pdf_fcn_1_bit,
                     size_t n_samples,
                     pdf_fcn_io_t min_sample,
                     pdf_fcn_io_t max_sample,
                     int sample_precision = 0);
 
-  friend code_metrics<pdf_fcn_io_t>*
-  code_metrics<pdf_fcn_io_t>::create
-  (pdf_fcn_t pdf_fcn_0_bit,
-   pdf_fcn_t pdf_fcn_1_bit,
+  friend code_metrics_table<pdf_fcn_io_t>*
+  libecc_code_metrics_create_table<pdf_fcn_io_t>
+  (pdf_fcn_io_t (*pdf_fcn_0_bit) (pdf_fcn_io_t),
+   pdf_fcn_io_t (*pdf_fcn_1_bit) (pdf_fcn_io_t),
    size_t n_samples,
    pdf_fcn_io_t min_sample,
    pdf_fcn_io_t max_sample,
@@ -148,6 +161,7 @@
 
   std::vector<metric_t> d_metric_table_0_bit, d_metric_table_1_bit;
 };
+
 #if 0
   // compute all output-bit combinations of the incoming symbols' metrics
 
@@ -158,4 +172,5 @@
   std::vector<unsigned long> in_l[2];
   std::vector<float> in_f[2];
 #endif
+
 #endif /* INCLUDED_CODE_METRICS_H */

Index: libecc/mld/n2bs.cc
===================================================================
RCS file: 
/sources/gnuradio/gr-error-correcting-codes/src/lib/libecc/mld/n2bs.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- libecc/mld/n2bs.cc  3 Jul 2006 02:14:12 -0000       1.1
+++ libecc/mld/n2bs.cc  2 Aug 2006 01:28:44 -0000       1.2
@@ -2,9 +2,7 @@
 /*
  * Copyright 2006 Free Software Foundation, Inc.
  * 
- * This file is part of GNU Radio.
- *
- * Primary Author: Michael Dickens, NCIP Lab, University of Notre Dame
+ * 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
@@ -24,13 +22,12 @@
 
 #include <n2bs.h>
 #include <iostream>
+#include "../code_types.h"
 
 const int g_num_bits_per_byte = 8;
 
-std::string n2bs (long long number, size_t digits)
+std::string DoIt (int64_t number, size_t digits)
 {
-  if (digits > (sizeof (long long) * g_num_bits_per_byte))
-    digits = sizeof (long long);
   std::string retVal (digits, '0');
   if (number != 0)
     for (int n = --digits; n >= 0; n--) {
@@ -41,29 +38,66 @@
     }
   return (retVal);
 }
-std::string n2bs (char number, size_t digits)
+
+std::string n2bs (int64_t number, size_t digits)
+{
+  if (digits > (sizeof (int64_t) * g_num_bits_per_byte))
+    digits = sizeof (int64_t);
+  return DoIt (number, digits);
+}
+std::string n2bs (int8_t number, size_t digits)
 {
-  if (digits > (sizeof (char) * g_num_bits_per_byte))
-    digits = sizeof (char);
-  return n2bs ((long long) number, digits);
+  if (digits > (sizeof (int8_t) * g_num_bits_per_byte))
+    digits = sizeof (int8_t);
+  return DoIt ((int64_t) number, digits);
 }
-std::string n2bs (int number, size_t digits)
+std::string n2bs (int16_t number, size_t digits)
 {
-  if (digits > (sizeof (int) * g_num_bits_per_byte))
-    digits = sizeof (int);
-  return n2bs ((long long) number, digits);
+  if (digits > (sizeof (int16_t) * g_num_bits_per_byte))
+    digits = sizeof (int16_t);
+  return DoIt ((int64_t) number, digits);
+}
+std::string n2bs (int32_t number, size_t digits)
+{
+  if (digits > (sizeof (int32_t) * g_num_bits_per_byte))
+    digits = sizeof (int32_t);
+  return DoIt ((int64_t) number, digits);
 }
 std::string n2bs (long number, size_t digits)
 {
   if (digits > (sizeof (long) * g_num_bits_per_byte))
     digits = sizeof (long);
-  return n2bs ((long long) number, digits);
+  return DoIt ((int64_t) number, digits);
+}
+std::string n2bs (u_int8_t number, size_t digits)
+{
+  if (digits > (sizeof (u_int8_t) * g_num_bits_per_byte))
+    digits = sizeof (u_int8_t);
+  return DoIt ((int64_t) number, digits);
+}
+std::string n2bs (u_int16_t number, size_t digits)
+{
+  if (digits > (sizeof (u_int16_t) * g_num_bits_per_byte))
+    digits = sizeof (u_int16_t);
+  return DoIt ((int64_t) number, digits);
+}
+std::string n2bs (u_int32_t number, size_t digits)
+{
+  if (digits > (sizeof (u_int32_t) * g_num_bits_per_byte))
+    digits = sizeof (u_int32_t);
+  return DoIt ((int64_t) number, digits);
+}
+std::string n2bs (unsigned long number, size_t digits)
+{
+  if (digits > (sizeof (unsigned long) * g_num_bits_per_byte))
+    digits = sizeof (unsigned long);
+  return DoIt ((int64_t) number, digits);
 }
-std::string n2bs (size_t number, size_t digits)
+std::string n2bs (u_int64_t number, size_t digits)
 {
-  if (digits > (sizeof (size_t) * g_num_bits_per_byte))
-    digits = sizeof (size_t);
-  return n2bs ((long long) number, digits);
+  if (digits > (sizeof (u_int64_t) * g_num_bits_per_byte))
+    digits = sizeof (u_int64_t);
+  return DoIt ((int64_t) number, digits);
 }
 
 void cout_binary (int number, int digits)

Index: libecc/mld/n2bs.h
===================================================================
RCS file: 
/sources/gnuradio/gr-error-correcting-codes/src/lib/libecc/mld/n2bs.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- libecc/mld/n2bs.h   3 Jul 2006 02:14:12 -0000       1.1
+++ libecc/mld/n2bs.h   2 Aug 2006 01:28:44 -0000       1.2
@@ -2,9 +2,7 @@
 /*
  * Copyright 2006 Free Software Foundation, Inc.
  * 
- * This file is part of GNU Radio.
- *
- * Primary Author: Michael Dickens, NCIP Lab, University of Notre Dame
+ * 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
@@ -22,11 +20,26 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#ifndef INCLUDED_N2BS_H
+#define INCLUDED_N2BS_H
+
 #include <string>
 
-extern std::string n2bs (char number, size_t digits);
-extern std::string n2bs (int number, size_t digits);
-extern std::string n2bs (long number, size_t digits);
-extern std::string n2bs (size_t number, size_t digits);
-extern std::string n2bs (long long number, size_t digits);
-extern void cout_binary (int number, int digits);
+std::string n2bs (int8_t number, size_t digits);
+std::string n2bs (int16_t number, size_t digits);
+std::string n2bs (int32_t number, size_t digits);
+#if 1
+std::string n2bs (long number, size_t digits);
+#endif
+std::string n2bs (int64_t number, size_t digits);
+std::string n2bs (u_int8_t number, size_t digits);
+std::string n2bs (u_int16_t number, size_t digits);
+std::string n2bs (u_int32_t number, size_t digits);
+#if 1
+std::string n2bs (unsigned long number, size_t digits);
+#endif
+std::string n2bs (u_int64_t number, size_t digits);
+
+void cout_binary (int number, int digits);
+
+#endif /* INCLUDED_N2BS_H */




reply via email to

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