Skip to content

Commit

Permalink
use div_ceil
Browse files Browse the repository at this point in the history
  • Loading branch information
UkoeHB committed Dec 22, 2024
1 parent 4666168 commit 2893a16
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion renet2/src/channel/reliable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub struct ReceiveChannelReliable {

impl UnackedMessage {
fn new_sliced(payload: Bytes) -> Self {
let num_slices = (payload.len() + SLICE_SIZE - 1) / SLICE_SIZE;
let num_slices = payload.len().div_ceil(SLICE_SIZE);

Self::Sliced {
message: payload,
Expand Down
2 changes: 1 addition & 1 deletion renet2/src/channel/unreliable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl SendChannelUnreliable {

*available_bytes -= message.len() as u64;
if message.len() > SLICE_SIZE {
let num_slices = (message.len() + SLICE_SIZE - 1) / SLICE_SIZE;
let num_slices = message.len().div_ceil(SLICE_SIZE);

for slice_index in 0..num_slices {
let start = slice_index * SLICE_SIZE;
Expand Down

0 comments on commit 2893a16

Please sign in to comment.