[refactor] Moved simple math calculations from runtime to compile time. #28947

pull 23rd wants to merge 1 commits into bitcoin:master from 23rd:patch-1-constexpr changing 13 files +24 −24
  1. 23rd commented at 2:08 PM on November 27, 2023: none

    The following constant values can be safely computed at compile time, but are currently computing at runtime.

  2. DrahtBot commented at 2:08 PM on November 27, 2023: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #28358 (Double -dbache maximum to 32GB by Sjors)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  3. hebasto commented at 2:11 PM on November 27, 2023: member

    Changes to the leveldb subtree must be submitted to upstream, not to this repo.

  4. [refactor] Moved simple math calculations from runtime to compile time. 4fd7742bee
  5. DrahtBot added the label CI failed on Nov 27, 2023
  6. 23rd commented at 2:32 PM on November 27, 2023: none

    Changes to the leveldb subtree must be submitted to upstream, not to this repo.

    Thanks. Have updated the commit.

  7. maflcko commented at 2:37 PM on November 27, 2023: member

    are currently computing at runtime.

    Do you have any referenced to support your claim? IIRC all supported compilers treat static const int = ..literal..; as a compile-time constant.

    If there is a reason to do the changes, it should ideally be enforced with a linter/tidy check, no?

  8. 23rd commented at 2:54 PM on November 27, 2023: none

    @maflcko Oh, I didn't really check asm result of static const int... definitions. Now I see they are the same as constexpr int. Thank you and sorry for my unnecessary PR.

  9. 23rd closed this on Nov 27, 2023

  10. bitcoin locked this on Nov 26, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-28 00:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me