merge-script b62abc7eec
Merge bitcoin/bitcoin#34436: refactor: add overflow-safe CeilDiv helper and use it in unsigned callsites
02d047fd5b93d96f159db2b8e95fc39450505159 refactor: add overflow-safe `CeilDiv` helper (Lőrinc)

Pull request description:

  ### Problem
  The codebase has many open-coded ceiling-division expressions (for example `(x+y-1)/y`) scattered across files.
  These are less readable, duplicate logic, and can be overflow-prone in edge cases.

  ### Fix
  Introduce a small overflow-safe integer helper, `CeilDiv()`, and use it in existing **unsigned** callsites where the conversion is straightforward and noise-free.

  ### What this PR does
  * Adds `CeilDiv()` to `src/util/overflow.h` for unsigned integral inputs.
  * Keeps the precondition check `assert(divisor > 0)`.
  * Replaces selected unsigned ceiling-division expressions with `CeilDiv(...)`.
  * Adds focused unit tests in `src/test/util_tests.cpp` for the migrated patterns.

  ---

  This is a pure refactor with no intended behavioral change.
  Signed arithmetic callsites are intentionally left unchanged in this PR.
  This PR changed a few more things originally but based on feedback reverted to the simplest cases only.

ACKs for top commit:
  rustaceanrob:
    ACK 02d047fd5b93d96f159db2b8e95fc39450505159
  hodlinator:
    ACK 02d047fd5b93d96f159db2b8e95fc39450505159
  sedited:
    ACK 02d047fd5b93d96f159db2b8e95fc39450505159

Tree-SHA512: b09336031f487e6ce289822e0ffeb8cfc8cfe8a2f4f3f49470748dfbd0a6cbab97498674cb8686dd2bd4ab6dd0b79cfdf2da00041fee12d109892e1bc5dde0ff
2026-03-11 11:30:42 +01:00
..
2026-02-03 11:19:01 +01:00
2025-05-19 16:40:33 +01:00
2026-02-17 21:40:46 +05:30
2026-02-25 14:36:19 -08:00
2025-09-30 11:06:43 -07:00
2026-01-22 10:35:14 -05:00
2026-03-04 15:06:34 +01:00
2025-11-14 01:17:38 +02:00
2026-02-02 17:22:31 +00:00