The helpers are used in the following commits to increase the safety of
conversions during cache size calculations.
Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
Co-authored-by: stickies-v <stickies-v@protonmail.com>
Notes:
- This requires some minor adjustments to work with c++17 (see TODO comments)
- Due to out of orders backports we need to create the overflow.h file.
- Fuzzers for checked and saturating adds cannot be included here due to these above mentioned out of order backports. They can be added later with 3 additional lines when implemented.
This is a partial backport of core#31483
https://github.com/bitcoin/bitcoin/pull/31483/commits/c03a2795a8e044d17835bbf03de0c64dc7b41da8
https://github.com/bitcoin/bitcoin/pull/31483/commits/d5e2c4a4097c799433cfc5367c61568fad2c784e
Depends on D18579