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

Replace CAtom's bitfield with packed struct #243

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

frmdstryr
Copy link
Contributor

Reduce manual bit fiddling...

Copy link

codecov bot commented Feb 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.67%. Comparing base (6b689f0) to head (969291a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #243   +/-   ##
=======================================
  Coverage   97.67%   97.67%           
=======================================
  Files          24       24           
  Lines        1074     1074           
  Branches      162      162           
=======================================
  Hits         1049     1049           
  Misses         12       12           
  Partials       13       13           

@frmdstryr frmdstryr force-pushed the catom-bitfield-to-packed-struct branch from bd72b02 to 8196ead Compare February 4, 2025 02:24
@frmdstryr
Copy link
Contributor Author

frmdstryr commented Feb 6, 2025

I made one more micro optimization.... In CAtom_new it currently calls atom->set_notifications_enabled( true );, instead of doing a second write (since it rewrites when setting slots), I inverted the meaning of the notifications bit so it is on by default.

I haven't looked if the compiler is smart enough to optimize it into a single write or not but this way it should only ever be one write.

Edit: I was curious

Current behavior: https://godbolt.org/z/P9zK9eEbK
Inverting logic: https://godbolt.org/z/zexx8rrnn

so it removes a single 'or' instruction

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