Fix a bunch of undefined behavior in CheckedNumericState
CheckedNumericState<T, NUMERIC_INTEGER> would unconditionally cast
the src type to the dest int type. If the source type was a floating
point type that didn't fit in the integer type, this was undefined
behavior.
So only cast if is_valid_ is true. To be able to check that, move
is_valid_ in front of the value_ field (since these are constexpr
ctors and we don't have C++14 constexpr).
BUG=669642
Review-Url: https://codereview.chromium.org/2537773009
Cr-Commit-Position: refs/heads/master@{#436055}
CrOS-Libchrome-Original-Commit: e5b63cc2f7896b3ed1e8d89c3cab0b077ac14cc9
1 file changed