Skip to content

Commit

Permalink
Remove unnecessary type casting in channel decode call
Browse files Browse the repository at this point in the history
  • Loading branch information
fredclausen committed May 23, 2023
1 parent dba4df1 commit 897bc7a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions rust/oxide-decoders/src/decoders/acars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ pub struct ACARSDecoder {
}

impl Decoder for ACARSDecoder {
fn decode(&mut self, length: u32) {
fn decode(&mut self, length: usize) {
self.demod_msk(length);
}

Expand Down Expand Up @@ -477,10 +477,10 @@ impl ACARSDecoder {
}
}

pub fn demod_msk(&mut self, len: u32) {
pub fn demod_msk(&mut self, len: usize) {
/* MSK demod */

for in_ in &mut self.dm_buffer.into_iter().take(len as usize) {
for in_ in &mut self.dm_buffer.into_iter().take(len) {
let s: f32 = 1800.0 / INTRATE as f32 * 2.0 * std::f32::consts::PI + self.msk_df;
let mut v: Complex<f32> = num::Complex::new(0.0, 0.0);
let mut o: f32;
Expand Down
2 changes: 1 addition & 1 deletion rust/oxide-decoders/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub enum ValidDecoderType {
}

pub trait Decoder: Send + Sync {
fn decode(&mut self, length: u32);
fn decode(&mut self, length: usize);
fn get_wf_iter(&self) -> std::slice::Iter<'_, Complex<f32>>;
fn set_dm_buffer_at_index(&mut self, index: usize, value: f32);
fn set_output_channel(&mut self, channel: UnboundedSender<AssembledACARSMessage>);
Expand Down
2 changes: 1 addition & 1 deletion rust/oxide-rtlsdr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ impl RtlSdr {
}
}
for channel in &mut self.channel.iter_mut().take(self.frequencies.len()) {
channel.decode(rtloutbufz as u32);
channel.decode(rtloutbufz);
}
})
.unwrap();
Expand Down

0 comments on commit 897bc7a

Please sign in to comment.