-
Notifications
You must be signed in to change notification settings - Fork 15
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
refactor: add bitwise_memcpy #567
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
nomt/src/beatree/ops/bit_ops.rs
Outdated
// Copy `source_bit_len` from the source bytes, starting from the `source_bit_init`ith bit | ||
// within the first byte into the destination, starting from the `destination_bit_init`ith bit | ||
// | ||
// `destination` must be long enough to store the bits, accounting also possible shifts. | ||
// `source` must have a length multiple of 8 bytes | ||
// | ||
// All the bits in `destination` not involved in the copy will be left unchanged. |
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 not make it a rustdoc?
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.
No real reason, it's a mistake, it should be a rustdoc yes
228f671
to
e0eef91
Compare
14c01c5
to
21d5177
Compare
e0eef91
to
fdd04bb
Compare
nomt/src/beatree/ops/bit_ops.rs
Outdated
destination: &mut [u8], | ||
destination_bit_init: usize, | ||
source: &[u8], | ||
source_bit_init: usize, |
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.
style: a slice start is usually referred to as "start" not "init". "init" implies that it's a value, not a position.
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.
Thanks, yes, this makes perfect sense. I generally use them interchangeably, but now that I have a clearer idea, I will use them properly!
abstract copy and shift bits logic
fdd04bb
to
cfdcca5
Compare
This pr not only extracts the shift and copy bits logic a new function(
bitwise_mempcy
), but also includes a slight update: nowbitwise_memcpy
leaves unchanged all the bits that are not part of the copy in the destinationedit. the pr now also includes a replacement of
init
withstart
every time it was not used correctly