-
Notifications
You must be signed in to change notification settings - Fork 353
feat(Rust): support sli_int64 compression #2914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| #[inline(always)] | ||
| pub fn write_sliint64(&mut self, value: i64) { | ||
| if value >= HALF_MIN_INT && value <= HALF_MAX_INT { | ||
| if (HALF_MIN_INT..=HALF_MAX_INT).contains(&value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use this range instead of conditional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the lint error and hint I got:
$ cargo clippy --all-targets --all-features -- -D warnings
error: manual `RangeInclusive::contains` implementation
--> fory-core\src\buffer.rs:182:12
|
182 | if value >= HALF_MIN_INT && value <= HALF_MAX_INT {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(HALF_MIN_INT..=HALF_MAX_INT).contains(&value)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
= note: `-D clippy::manual-range-contains` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::manual_range_contains)]`You can see detail at https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
Maybe more Rust-idiomatic, but actually, I think the condition is still more intuitive.
|
Since the tests for RustXlangTest are identical to CPPXlangTest, and |
|
Let me implement it in another PR for c++ |
ok😀 |
What does this PR do?
Writer::write_sliint64(...)andReader::read_sliint64(...)to support SLI_INT64 compression.Reader::read_i32/i64/sliint64()andWriter::read_i32/i64/sliint64().Related issues
#2903
Does this PR introduce any user-facing change?
new methods:
Writer::write_sliint64(...)andReader::read_sliint64(...)