mirror of
https://github.com/BLAKE3-team/BLAKE3
synced 2024-05-23 12:56:07 +02:00
Merge a8ae6b4fa2
into 4ec3be8bfa
This commit is contained in:
commit
9fb7fca315
34
src/lib.rs
34
src/lib.rs
|
@ -509,23 +509,23 @@ impl ChunkState {
|
||||||
// Try to avoid buffering as much as possible, by compressing directly from
|
// Try to avoid buffering as much as possible, by compressing directly from
|
||||||
// the input slice when full blocks are available.
|
// the input slice when full blocks are available.
|
||||||
fn update(&mut self, mut input: &[u8]) -> &mut Self {
|
fn update(&mut self, mut input: &[u8]) -> &mut Self {
|
||||||
if self.buf_len > 0 {
|
if !input.is_empty() && self.buf_len > 0 {
|
||||||
self.fill_buf(&mut input);
|
self.fill_buf(&mut input);
|
||||||
if !input.is_empty() {
|
debug_assert_eq!(self.buf_len as usize, BLOCK_LEN);
|
||||||
debug_assert_eq!(self.buf_len as usize, BLOCK_LEN);
|
let block_flags = self.flags | self.start_flag();
|
||||||
let block_flags = self.flags | self.start_flag(); // borrowck
|
self.platform.compress_in_place(
|
||||||
self.platform.compress_in_place(
|
&mut self.cv,
|
||||||
&mut self.cv,
|
&self.buf,
|
||||||
&self.buf,
|
BLOCK_LEN as u8,
|
||||||
BLOCK_LEN as u8,
|
self.chunk_counter,
|
||||||
self.chunk_counter,
|
block_flags,
|
||||||
block_flags,
|
);
|
||||||
);
|
self.buf_len = 0;
|
||||||
self.buf_len = 0;
|
self.buf = [0; BLOCK_LEN];
|
||||||
self.buf = [0; BLOCK_LEN];
|
self.blocks_compressed += 1;
|
||||||
self.blocks_compressed += 1;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
while input.len() > BLOCK_LEN {
|
while input.len() > BLOCK_LEN {
|
||||||
debug_assert_eq!(self.buf_len, 0);
|
debug_assert_eq!(self.buf_len, 0);
|
||||||
|
|
Loading…
Reference in New Issue