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

@atomicRmw - support bool and non-power-of-2 int types #1220

Closed
andrewrk opened this issue Jul 11, 2018 · 2 comments · Fixed by #4707
Closed

@atomicRmw - support bool and non-power-of-2 int types #1220

andrewrk opened this issue Jul 11, 2018 · 2 comments · Fixed by #4707
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase.
Milestone

Comments

@andrewrk
Copy link
Member

bool and non-power-of-2 int types are still power of 2 int types under the hood. We can do secret pointer casts on them before and after calling llvm's atomicrmw instruction (these pointer casts will be no-ops in machine code).

There are TODO comments in zig std lib and in the language reference once this is complete.

Same thing goes for @cmpxchgWeak and @cmpxchgStrong.

@andrewrk andrewrk added the enhancement Solving this issue will likely involve adding new logic or components to the codebase. label Jul 11, 2018
@andrewrk andrewrk added this to the 0.4.0 milestone Jul 11, 2018
@andrewrk andrewrk mentioned this issue Jul 11, 2018
8 tasks
@BarabasGitHub
Copy link
Contributor

How will that work when you have multiple of them in a struct?

@andrewrk
Copy link
Member Author

Can you elaborate? It will work the same way that multiple non-power-of-2 int types work in a non-packed struct.

@andrewrk andrewrk modified the milestones: 0.4.0, 0.5.0 Sep 28, 2018
@andrewrk andrewrk modified the milestones: 0.5.0, 0.6.0 May 9, 2019
@andrewrk andrewrk modified the milestones: 0.6.0, 0.7.0 Dec 9, 2019
@andrewrk andrewrk modified the milestones: 0.7.0, 0.6.0 Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants