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

vm: implement vm::atomic_op, fetch_op helpers #9523

Merged
merged 1 commit into from
Dec 30, 2020

Conversation

Nekotekina
Copy link
Member

Can help to reduce lambda depth hell a little.

const s32 _new = val + value;
val = static_cast<u8>(std::clamp<s32>(_new, 0, 255));
});
val = static_cast<u8>(std::clamp<s64>(val + s64{value}, 0, 255));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think fw uses CMPWI instructions here for clamping, its ok for now, I'll check it later and worst case ill partially revert it.

Copy link
Member Author

Choose a reason for hiding this comment

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

May need to emulate signed overflow without UB, unless it's just impossible.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nvm, I think I fixed it. Just use unsigned arithmetic.

Can help to reduce lambda depth hell a little.
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.

None yet

2 participants