Problem
Byte-size conversions in the codebase currently show up in many equivalent formats (multiplication/division chains, shifts, hex/binary literals), which creates a maintenance burden and makes review error-prone - especially considering the architectural differences of size_t.
Inspired by #34305 (review), it seemed appropriate to unify Mebibyte usage across the codebase and add Gibibyte support with 32/64 bit size_t validation.
Fix
This PR refactors those call sites to use ""_MiB (existing) and ""_GiB (new), and adds the encountered value/pattern replacements to unit tests to make review straightforward, and to ensure the conversions remain valid.
The literals are overflow-checked when converting to size_t, and unit tests cover the 32-bit boundary cases.
Concretely, it replaces patterns such as:
1024*1024,1<<20,0x100000,1048576,/ 1024 / 1024,* (1.0 / 1024 / 1024)→1_MiBordouble(1_MiB)1024*1024*1024,1<<30,0x40000000,1024_MiB,>> 30→1_GiB
(added unit tests for each replacement category to ease review)
Additionally, declarations whose initializer reads a _MiB/_GiB literal are switched to braced initialization so a future oversized value is rejected at compile time through the narrowing check instead of silently truncating.
Note
In the few places where arithmetic involves signed values, the result is identical to the previous code assuming those quantities never become negative.