refactor: modernize FuzzedDataProvider with if constexpr and safe casts #34396

pull b-l-u-e wants to merge 1 commits into bitcoin:master from b-l-u-e:refactor-modernize-fuzzed-data-provider-with-constexpr changing 1 files +3 −4
  1. b-l-u-e commented at 10:41 pm on January 23, 2026: contributor

    This PR modernizes FuzzedDataProvider.h by resolving outstanding C++17 migration TODOs.

    1. Replace conditional with if constexpr in ConvertUnsignedToSigned

      • The TODO noted this should be changed once C++17 becomes mainstream
    2. Fix signed/unsigned comparison

      • Add explicit cast in comparison to avoid implicit conversions
      • Makes the type conversion explicit and safer
    3. Remove outdated TODO in PickValueInArray

      • The TODO suggested using static_assert, but this is not possible since std::initializer_list::size() is a runtime value when passed as a function parameter

    Motivation:

    These TODOs have been present since the code was written, waiting for C++14/C++17 adoption. Since Bitcoin Core now uses C++20, these modernizations are long overdue.

  2. refactor: modernize FuzzedDataProvider with if constexpr and safe casts 4059457410
  3. DrahtBot added the label Refactoring on Jan 23, 2026
  4. DrahtBot commented at 10:41 pm on January 23, 2026: contributor

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

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34396.

    Reviews

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

  5. l0rinc commented at 10:47 pm on January 23, 2026: contributor
  6. b-l-u-e commented at 11:06 pm on January 23, 2026: contributor
  7. b-l-u-e marked this as a draft on Jan 23, 2026
  8. b-l-u-e closed this on Jan 23, 2026

  9. b-l-u-e commented at 8:36 pm on January 24, 2026: contributor

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-01-27 06:13 UTC

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