Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions builtin/bitstring.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ pub fn ArrayView::unsafe_extract_byte(
(byte >> shift) & mask
} else {
// extract 16 bits at [byte_index, byte_index + 1]
let b0 = bs.unsafe_get(byte_index).to_uint()
let b1 = bs.unsafe_get(byte_index + 1).to_uint()
let data = (b0 << 8) | b1
guard! bs[byte_index:] is [u16be(data), ..]
// mask off the top bits

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xx.get(i) is Some(y)
xx.get_view(i,j) is Some([i,j....]

let bit_mask = (1U << (16 - (offset & 7))) - 1
let data = data & bit_mask
Expand Down Expand Up @@ -959,9 +957,7 @@ pub fn BytesView::unsafe_extract_byte(
(byte >> shift) & mask
} else {
// extract 16 bits at [byte_index, byte_index + 1]
let b0 = bs.unsafe_get(byte_index).to_uint()
let b1 = bs.unsafe_get(byte_index + 1).to_uint()
let data = (b0 << 8) | b1
guard! bs[byte_index:] is [u16be(data), ..]
// mask off the top bits
let bit_mask = (1U << (16 - (offset & 7))) - 1
let data = data & bit_mask
Expand Down
Loading