Skip to content

refactor: use inline constexpr for ID_TRANS - #105

Merged
sipa merged 1 commit into
bitcoin-core:masterfrom
fanquake:use_inline_constexpr
Sep 16, 2026
Merged

sipa merged 1 commit into
bitcoin-core:masterfrom
fanquake:use_inline_constexpr

Conversation

@fanquake

Copy link
Copy Markdown
Member

Used downstream in bitcoin/bitcoin#36167.

@maflcko

maflcko commented Sep 16, 2026

Copy link
Copy Markdown

Looks like this needs to be guarded by C++17, or the minimum required C++ version needs to be increased to that?

@fanquake
fanquake force-pushed the use_inline_constexpr branch 2 times, most recently from 6b1f6a4 to 9e92fdb Compare September 16, 2026 15:24
Comment thread src/lintrans.h Outdated
Comment on lines +148 to +150
#if __cplusplus >= 201703L
inline constexpr IdTrans ID_TRANS{};
#else

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
#if __cplusplus >= 201703L
inline constexpr IdTrans ID_TRANS{};
#else
#if __cplusplus >= 201703L
inline
#endif // __cplusplus >= 201703L

nit: for a smaller diff/code 😅

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Pushed that

@fanquake
fanquake force-pushed the use_inline_constexpr branch from 9e92fdb to 2ac4b7c Compare September 16, 2026 15:31
fanquake added a commit to fanquake/bitcoin that referenced this pull request Sep 16, 2026
@sipa

sipa commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

ACK 2ac4b7c

@sipa
sipa merged commit a12f5de into bitcoin-core:master Sep 16, 2026
5 checks passed
@fanquake
fanquake deleted the use_inline_constexpr branch September 16, 2026 20:13
fanquake added a commit to fanquake/bitcoin that referenced this pull request Sep 18, 2026
fanquake added a commit to fanquake/bitcoin that referenced this pull request Sep 21, 2026
hebasto pushed a commit to bitcoin/bitcoin that referenced this pull request Sep 21, 2026
a12f5de1c9 Merge bitcoin-core/minisketch#105: refactor: use inline constexpr for ID_TRANS
2ac4b7c624 refactor: use inline constexpr for ID_TRANS

git-subtree-dir: src/minisketch
git-subtree-split: a12f5de1c96e21d76f64bc647ae4f65e4fc1b636
hebasto added a commit to bitcoin/bitcoin that referenced this pull request Sep 21, 2026
fcb2d83 Squashed 'src/minisketch/' changes from 4a179c61e3..a12f5de1c9 (fanquake)

Pull request description:

  Includes:
  * bitcoin-core/minisketch#105

  Used in #36275.

ACKs for top commit:
  hebasto:
    ACK 749bd10.

Tree-SHA512: 0637e2af27d6bc84b61296840b4cfd8503162ca8d37226282b10b03f4fa7637bfbfd873146d13d4f76bfd105f2a6cfb5861169730514b6c668a77984ca7b8b39
Kino1994 pushed a commit to Kino1994/bitcoin-full-history that referenced this pull request Sep 28, 2026
fcb2d83 Squashed 'src/minisketch/' changes from 4a179c61e3..a12f5de1c9 (fanquake)

Pull request description:

  Includes:
  * bitcoin-core/minisketch#105

  Used in #36275.

ACKs for top commit:
  hebasto:
    ACK 749bd10fdf0106d39fb9960c8bd1b96b12c944ca.

Tree-SHA512: 0637e2af27d6bc84b61296840b4cfd8503162ca8d37226282b10b03f4fa7637bfbfd873146d13d4f76bfd105f2a6cfb5861169730514b6c668a77984ca7b8b39
vmta added a commit to umkoin/umkoin that referenced this pull request Oct 8, 2026
a12f5de1c Merge bitcoin-core/minisketch#105: refactor: use inline constexpr for ID_TRANS
2ac4b7c62 refactor: use inline constexpr for ID_TRANS
4a179c61e Merge bitcoin-core/minisketch#102: Avoid Clang's `-Wunused-template` under restricted field selections
d14cd495f Avoid Clang's `-Wunused-template` under restricted field selections
d1bd01e18 Merge bitcoin-core/minisketch#98: misc: drop trailing whitespace
fe2c88a4f misc: drop trailing whitespace
f74b7e2bc Merge bitcoin-core/minisketch#75: build: Introduce CMake-based build system
850cc868d ci: Add GHA workflow with native Windows job
40d56708c doc: Add "Building with CMake" section to `README.md`
a0c86c79a build: Add CMake-based build system
ea8f66b1e Merge bitcoin-core/minisketch#89: header: Delete default Minisketch constructor
fc2495864 Merge bitcoin-core/minisketch#94: misc: trim trailing whitespace
485b16e7f misc: trim trailing whitespace
d1e6bb8bb Merge bitcoin-core/minisketch#92: doc: rename from sipa to bitcoin-core
b7b7dd0ec doc: rename from sipa to bitcoin-core
eb37a9b8e Merge bitcoin-core/minisketch#87: Avoid copy in self-assign
fe6557642 Merge bitcoin-core/minisketch#88: build: Add `-Wundef`
5cc7d2086 header: Delete default Minisketch constructor
8ea298bfa Avoid copy in self-assign
978a3d886 build: Add `-Wundef`
338704417 Merge bitcoin-core/minisketch#86: doc: fix typo in sketch_impl.h
15c2d13b6 doc: fix typo in sketch_impl.h
7be08b8a4 Merge bitcoin-core/minisketch#85: Fixes for integer precision loss
00fb4a4d8 Avoid or make integer precision conversion explicit
9d62a4d27 Avoid the need to cast/convert to size_t for vector operations
19e06cc7a Prevent overflows from large capacity/max_elements
3472e2f5e Merge bitcoin-core/minisketch#81: Avoid overflowing shift by special casing inverse of 1
653d8b2e2 Avoid overflowing shift by special casing inverse of 1
33b7c200b Merge bitcoin-core/minisketch#80: Add c++20 version of CountBits
4a48f31a3 Merge bitcoin-core/minisketch#83: ci: Fix "s390x (big-endian)" task
82b6488ac Add c++20 version of CountBits
0498084d3 ci: Fix "s390x (big-endian)" task
71709dca9 Merge bitcoin-core/minisketch#82: ci: Fix `x86_64-w64-mingw32` task
9e6127fa9 Merge bitcoin-core/minisketch#74: Avoid >> above type width in BitWriter
ed420bc17 ci: Fix `x86_64-w64-mingw32` task
fe1040f22 Drop -Wno-shift-count-overflow compile flag
154bcd43b Avoid >> above type width in BitWriter
67b87acdb Merge bitcoin-core/minisketch#78: ci: Update macOS image for CI
7de725041 ci: Update macOS image for CI
83d812ea9 Merge bitcoin-core/minisketch#73: ci: Use correct variable to designate C++ compiler
e051a7d69 ci: Install wine32 package for Windows tests
2d2c695d7 build: Drop unused `CC` variable
1810fcbd1 ci: Use correct variable to designate C++ compiler
022b95904 Merge bitcoin-core/minisketch#77: Add missing include
08443c489 Add missing include
a571ba20f Merge bitcoin-core/minisketch#68: Add missed `#include <string>`
b9a7f7e2b Merge bitcoin-core/minisketch#69: refactor: Drop unused `total` local variables
8a5af94ed Merge bitcoin-core/minisketch#70: build: Remove `-Qunused-arguments` workaround for clang + ccache
c36f1f03a Merge bitcoin-core/minisketch#72: Fix MSVC implementation of `CountBits()` function
0078bedda Ignore `HAVE_CLZ` macro when building with MSVC
1c772918c Fix MSVC implementation of `CountBits()` function
98f87c55f build: Remove `-Qunused-arguments` workaround for clang + ccache
11a1e25c8 refactor: Drop unused `total` local variables
ed6c8fcfd Add missed `#include <string>`
47f0a2d26 Merge bitcoin-core/minisketch#66: msvc: remove direct Bitcoin Core `compat.h` include
64f17584c msvc: remove Core compat.h include

git-subtree-dir: src/minisketch
git-subtree-split: a12f5de1c96e21d76f64bc647ae4f65e4fc1b636
ajtowns pushed a commit to ajtowns/bitcoin that referenced this pull request Oct 23, 2026
a12f5de1c9 Merge bitcoin-core/minisketch#105: refactor: use inline constexpr for ID_TRANS
2ac4b7c624 refactor: use inline constexpr for ID_TRANS

git-subtree-dir: src/minisketch
git-subtree-split: a12f5de1c96e21d76f64bc647ae4f65e4fc1b636
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.

3 participants