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

Make decode function const #23

Merged
merged 1 commit into from
Nov 29, 2023
Merged

Make decode function const #23

merged 1 commit into from
Nov 29, 2023

Conversation

Johnabell
Copy link
Owner

This PR makes the instruction decode function const. Therefore this can be evaluated at compile time for optomization purposes.

@Johnabell Johnabell self-assigned this Sep 5, 2023
impl From<u8> for Register {
fn from(value: u8) -> Register {
impl Register {
pub(crate) const fn const_from(value: u8) -> Register {
Copy link
Owner Author

Choose a reason for hiding this comment

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

Looking forward to not having to do this when this lands: rust-lang/rust#67792

@Johnabell Johnabell requested a review from andybalaam September 5, 2023 20:27
@Johnabell Johnabell mentioned this pull request Sep 6, 2023
Copy link
Collaborator

@andybalaam andybalaam left a comment

Choose a reason for hiding this comment

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

I like it.

@Johnabell Johnabell merged commit 81de359 into master Nov 29, 2023
@Johnabell Johnabell deleted the const-decode branch November 29, 2023 00:46
@andybalaam andybalaam restored the const-decode branch November 29, 2023 01:23
@andybalaam andybalaam deleted the const-decode branch November 29, 2023 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants