-
Notifications
You must be signed in to change notification settings - Fork 36
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
Adds support for eexps with 12- and 20-bit addresses #825
Conversation
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.
🗺️ PR Tour 🧭
EExpressionWith4BitAddress, // 0x00-0x3F - | ||
EExpressionWith12BitAddress, // 0x40-0x4F - | ||
EExpressionWith20BitAddress, // 0x50-0x5F - |
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.
🗺️ Of this block, these three lines (EExpressionWith*BitAddress
) are the new/interesting ones. The others are highlighted because the comments were automatically realigned.
EExpressionWith4BitAddress | ||
| EExpressionWith12BitAddress | ||
| EExpressionWith20BitAddress | ||
| EExpressionWithLengthPrefix => { | ||
ParseValueExprResult::EExp(self.read_e_expression(opcode)) |
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.
🗺️ I've been considering adding a less granular OpcodeKind
or similar alongside OpcodeType
to capture high-level groups like EExpression
or Value
for places like this where we don't actually care about the encoding just yet.
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.
Overall it looks great.
&[ | ||
// Opcode with low nibble setting bias | ||
0x50 | low_opcode_nibble as u8, | ||
], |
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.
&[ | |
// Opcode with low nibble setting bias | |
0x50 | low_opcode_nibble as u8, | |
], | |
// Opcode with low nibble setting bias | |
0x50 | low_opcode_nibble as u8, |
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.
The extend_from_slices_copy
method takes a slice-of-slices (&[&[u8]]
). For potentially interesting information about the motivation for this method, check out the PR that introduced it.
Now that I'm re-reading this, though, I could rewrite it to call (biased as u16).to_le_bytes()
in advance and pack the two bytes into this slice manually. I think I'll do that.
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.
I see that now. I missed that the call on L701 was extend_from_slice_copy
whereas the call on L713 was extend_from_slices_copy
.
Prior to this PR, e-expressions with an address between
0..64
could be encoded as a single-byte opcode and larger e-expressions could only be encoded as a length-prefixed e-expression.This patch adds read and write support for binary e-expressions that have a trailing 1- or 2-byte
FixedUInt
to complete the address.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.