Skip to content
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

Interpreter: add bitmask to extract bits from foreign field limbs #1863

Merged
merged 1 commit into from
Feb 28, 2024

Conversation

dannywillems
Copy link
Member

@dannywillems dannywillems commented Feb 28, 2024

Tests coming in 2 or 3 PRs

@dannywillems dannywillems force-pushed the dw/serializer-env-add-bitmask branch from e551aad to 4c87d1b Compare February 28, 2024 12:12
/// Extract the bits from the variable `x` between `highest_bit` and `lowest_bit`, and store
/// the result in `position`.
/// `lowest_bit` becomes the least-significant bit of the resulting value.
fn bitmask(
Copy link
Member

Choose a reason for hiding this comment

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

Maybe I don't exactly get the plan, but do we plan to implement another instance of InterpreterEnv? If not, what's the value of the trait if it's very tailored to the implementation and has exactly one?..

position: Self::Position,
) -> Self::Variable {
let x: u128 = *x;
let res = (x >> lowest_bit) & ((1 << (highest_bit - lowest_bit)) - 1);
Copy link
Member

Choose a reason for hiding this comment

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

Always confused about +-1 in the semantics of shifts, aside from that seems correct

Base automatically changed from dw/serializer-define-column-structure to master February 28, 2024 14:13
@dannywillems dannywillems merged commit 86e9260 into master Feb 28, 2024
4 checks passed
@dannywillems dannywillems deleted the dw/serializer-env-add-bitmask branch February 28, 2024 14:13
@dannywillems dannywillems self-assigned this Mar 7, 2024
@dannywillems dannywillems added the enhancement New feature or request label Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants