tisonkun commented on code in PR #399:
URL: https://github.com/apache/datasketches-rust/pull/399#discussion_r4644249546
##########
datasketches/src/hll/array8.rs:
##########
@@ -263,24 +263,25 @@ impl Array8 {
"HLL8 zero count must not exceed k and auxiliary count must be
zero",
));
}
- let available_bytes = cursor.remaining().len();
- if available_bytes < k {
- return Err(Error::insufficient_data_of(
+ let payload = cursor.remaining();
+ let registers = payload.get(..k).ok_or_else(|| {
+ Error::insufficient_data_of(
"HLL8 payload",
- format_args!("expected {k} bytes, got {available_bytes}"),
- ));
+ format_args!("expected {k} bytes, got {}", payload.len()),
+ )
+ })?;
+ if registers
+ .chunks(256)
+ .any(|block| block.iter().copied().max().unwrap_or(0) > 63)
Review Comment:
```suggestion
.any(|block| block.iter().fold(0u8, |acc, &v| acc | v) > 63)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]