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

Potential C++20 improvements #1133

Open
TomHarte opened this issue May 10, 2023 · 2 comments
Open

Potential C++20 improvements #1133

TomHarte opened this issue May 10, 2023 · 2 comments

Comments

@TomHarte
Copy link
Owner

TomHarte commented May 10, 2023

A bit of a laundry list, as and when they reveal themselves:

  • std::popcount(x) & 1 is optimised to direct use of the parity flag on x86 on all mainstream compilers, and looks like the sensible log2() list of eors on ARM;
  • the bit header also provides direct access to rotates, and fast byte swaps which are likely to be essential to supporting the 68020 and above, that permit unaligned big-endian reads.

Also std::filesystem could be used to avoid e.g. get_extension in the static analyser as of C++17 but on the Mac is only implemented as of macOS v10.15 so will need to wait for a version bump there.

@ryandesign
Copy link
Contributor

std::filesystem […] is only implemented as of macOS v10.15

It's implemented in the version of libc++ included with macOS 10.15 and later but is otherwise independent of the macOS version. You could continue to support older macOS versions by building a newer version of libc++ and using that libc++ when you build Clock Signal and including that libc++ in your app bundle. All that could potentially be automated in the CMake and Xcode build systems but no need to start investigating that until you decide you want to use std::filesystem.

@ryandesign
Copy link
Contributor

There is also a third-party std::filesystem-compatible header-only library called ghc::filesystem (no relation to ghc) that requires nothing more than C++11.

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

No branches or pull requests

2 participants