style-only: Use std::clamp for check_ratio, rename
Summary:
This is a partial backport of core#22564
https://github.com/bitcoin/bitcoin/pull/22564/commits/eca4ca4d60599c9dbdd4e03a73beb33e9b44655a
Depends on D13088
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, sdulfari
Reviewed By: #bitcoin_abc, sdulfari
Differential Revision: https://reviews.bitcoinabc.org/D13089