summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-02-29 09:52:46 -0800
committerJosh Blum <josh@joshknows.com>2012-02-29 09:52:46 -0800
commita58ee6e29a9859b7eebb261fdcddf60de627c1aa (patch)
tree02a70de9107c1e14b826ac2ebf0c2d9fa2ca360b
parentfedad06362e22f8a171bfe8ae0b747492d22de1d (diff)
downloaduhd-a58ee6e29a9859b7eebb261fdcddf60de627c1aa.tar.gz
uhd-a58ee6e29a9859b7eebb261fdcddf60de627c1aa.tar.bz2
uhd-a58ee6e29a9859b7eebb261fdcddf60de627c1aa.zip
uhd: fix sc16 to sc8 conversion table
1) this was registered as the sc8 to sc16 converter, probably messed that up as well 2) the cast to index was wrong, now unit test passes
-rw-r--r--host/lib/convert/convert_with_tables.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/host/lib/convert/convert_with_tables.cpp b/host/lib/convert/convert_with_tables.cpp
index 4a3ce29b2..cd7773d4b 100644
--- a/host/lib/convert/convert_with_tables.cpp
+++ b/host/lib/convert/convert_with_tables.cpp
@@ -59,16 +59,16 @@ public:
item32_t lookup(const sc16_t &in0, const sc16_t &in1){
if (swap){ //hope this compiles out, its a template constant
return
- (item32_t(_table[size_t(in0.real())]) << 16) |
- (item32_t(_table[size_t(in0.imag())]) << 24) |
- (item32_t(_table[size_t(in1.real())]) << 0) |
- (item32_t(_table[size_t(in1.imag())]) << 8) ;
+ (item32_t(_table[boost::uint16_t(in0.real())]) << 16) |
+ (item32_t(_table[boost::uint16_t(in0.imag())]) << 24) |
+ (item32_t(_table[boost::uint16_t(in1.real())]) << 0) |
+ (item32_t(_table[boost::uint16_t(in1.imag())]) << 8) ;
}
return
- (item32_t(_table[size_t(in0.real())]) << 8) |
- (item32_t(_table[size_t(in0.imag())]) << 0) |
- (item32_t(_table[size_t(in1.real())]) << 24) |
- (item32_t(_table[size_t(in1.imag())]) << 16) ;
+ (item32_t(_table[boost::uint16_t(in0.real())]) << 8) |
+ (item32_t(_table[boost::uint16_t(in0.imag())]) << 0) |
+ (item32_t(_table[boost::uint16_t(in1.real())]) << 24) |
+ (item32_t(_table[boost::uint16_t(in1.imag())]) << 16) ;
}
private:
@@ -272,11 +272,11 @@ UHD_STATIC_BLOCK(register_convert_sc16_item32_1_to_fcxx_1){
id.input_format = "sc8_item32_le";
uhd::convert::register_converter(id, &make_convert_sc8_item32_le_1_to_sc16_1, PRIORITY_TABLE);
- id.output_format = "sc16";
- id.input_format = "sc8_item32_be";
+ id.input_format = "sc16";
+ id.output_format = "sc8_item32_be";
uhd::convert::register_converter(id, &make_convert_sc16_1_to_sc8_item32_be_1, PRIORITY_TABLE);
- id.output_format = "sc16";
- id.input_format = "sc8_item32_le";
+ id.input_format = "sc16";
+ id.output_format = "sc8_item32_le";
uhd::convert::register_converter(id, &make_convert_sc16_1_to_sc8_item32_le_1, PRIORITY_TABLE);
}