MCPcopy Create free account
hub / github.com/catboost/catboost / ParseSlow

Method ParseSlow

util/string/cast.cpp:162–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160 }
161
162 static inline EParseStatus ParseSlow(const TChar** ppos, const TChar* end, T max, T* target) noexcept {
163 T result = T();
164 T preMulMax = max / base;
165 const TChar* pos = *ppos;
166
167 while (pos != end) {
168 T digit;
169
170 if (!CharToDigit<base>(*pos, &digit)) {
171 *ppos = pos;
172
173 return PS_BAD_SYMBOL;
174 }
175
176 if (result > preMulMax) {
177 return PS_OVERFLOW;
178 }
179
180 result *= base;
181
182 if (result > max - digit) {
183 return PS_OVERFLOW;
184 }
185
186 result += digit;
187 pos++;
188 }
189
190 *target = result;
191
192 return PS_OK;
193 }
194 };
195
196 template <class T>

Callers

nothing calls this directly

Calls 1

TClass · 0.70

Tested by

no test coverage detected