DescriptionAdd numeric_cast for checked integral narrowing casts
In work on bringing up Windows x64, there are many places that need
to be safely narrowed to the types used for interacting with other
APIs (particularly when using containers). Rather than scatter these
CHECKs all over, numeric_cast<> CHECKs that the runtime value can be
safely converted to the target type.
BUG=8606, 167187, 166496
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=177264
Patch Set 1 #Patch Set 2 : review fixes #Patch Set 3 : rename to safe_numerics #
Total comments: 15
Patch Set 4 : review fixes #
Total comments: 2
Patch Set 5 : -> checked_numeric_cast #Patch Set 6 : add some more test cases #Patch Set 7 : initial attempt via template specialization #Patch Set 8 : macroize to reduce noise #Patch Set 9 : remove temp code #Patch Set 10 : add exhaustive test, fix comment #Patch Set 11 : add exhaustive test, fix comment #Patch Set 12 : rename macro #Patch Set 13 : simplify #
Total comments: 2
Messages
Total messages: 26 (0 generated)
|