Skip to content

Commit

Permalink
Fix division by zero when packet size is less than 32
Browse files Browse the repository at this point in the history
  • Loading branch information
cberner committed Nov 25, 2023
1 parent 378baee commit 7939144
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,13 @@ impl ObjectTransmissionInformation {
max_packet_size: u16,
decoder_memory_requirement: u64,
) -> ObjectTransmissionInformation {
let alignment = 8;
let (alignment, sub_symbol_size) = if max_packet_size >= 8 * 8 {
(8, 8)
} else {
(1, 1)
};
assert!(max_packet_size >= alignment);
let symbol_size = max_packet_size - (max_packet_size % alignment);
let sub_symbol_size = 8;

let kt = int_div_ceil(transfer_length, symbol_size as u64);

Expand Down

0 comments on commit 7939144

Please sign in to comment.