28 if (strc.Contains(
'.')) {
29 value_ = StringToFloat(strc);
38 FX_SAFE_UINT32 unsigned_val = 0;
39 bool bIsSigned =
false;
40 bool bNegative =
false;
45 }
else if (strc[0] ==
'-') {
51 for (; cc < strc.GetLength() && isdigit(strc[cc]); ++cc) {
55 unsigned_val = unsigned_val * 10 + (strc[cc] -
'0');
58 uint32_t uValue = unsigned_val.ValueOrDefault(0);
66 constexpr uint32_t uLimit =
67 static_cast<uint32_t>(
std::numeric_limits<
int>::max());
69 if (uValue > (bNegative ? uLimit + 1 : uLimit))
73 int32_t value =
static_cast<int32_t>(uValue);
79 static constexpr int kMinInt =
std::numeric_limits<
int>::min();
80 value_ = LIKELY(value != kMinInt) ? -value : kMinInt;
97 if (absl::holds_alternative<uint32_t>(value_)) {
98 return static_cast<int32_t>(absl::get<uint32_t>(value_));
100 if (absl::holds_alternative<int32_t>(value_)) {
101 return absl::get<int32_t>(value_);
103 return pdfium::base::saturated_cast<int32_t>(absl::get<
float>(value_));