Skip to content

Conversation

@LanderlYoung
Copy link

@LanderlYoung LanderlYoung commented Dec 24, 2025

This is a super WIP (Work in Progress) attempt, shared for discussion purposes. Hope it's not too disruptive.

Code Changes

To enable header-only mode, the following changes have been made:

  1. Added the inline keyword to all functions in the .cc files.
  2. Changed all anonymous namespaces to a named namespace (detail) in the .cc files.
  3. Changed static class field to inline global variable.
  4. Included the .cc file from its corresponding header file.

CMake Changes

An INTERFACE library has been added.

TODO

  1. The pre_target.cc file is not yet completed, as it relies on for_each.h with some magical macros 😸.
  2. The HWY_HEADER_ONLY_FUN macro seems a bit clumsy; perhaps just using the inline keyword would be better.
  3. Bazel build fails for now.

References

@google-cla
Copy link

google-cla bot commented Dec 24, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

1. Added the `inline` keyword to all functions in the `.cc` files.
2. Changed all anonymous namespaces to a named namespace (`detail`) in the `.cc` files.
3. Changed static class field to inline global variable.
4. Included the `.cc` file from its corresponding header file.

An `INTERFACE` library has been added.
Copy link
Member

@jan-wassenberg jan-wassenberg left a comment

Choose a reason for hiding this comment

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

Very nice! I could imagine landing a change like this. Some comments:

} // namespace detail

HWY_HEADER_ONLY_FUN
HWY_DLLEXPORT int Unpredictable1() { return timer::Start() != ~0ULL; }
Copy link
Member

Choose a reason for hiding this comment

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

Might be worthwhile to merge these into a HWY_HEADER_ONLY_EXPORT?

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