MCPcopy Create free account
hub / github.com/alibaba/graph-learn / FastStringTo32

Function FastStringTo32

graphlearn/src/common/string/numeric.cc:174–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174bool FastStringTo32(const char* str, int32_t* value) {
175 char* end = nullptr;
176 errno = 0;
177 int64_t ret = strtol(str, &end, 10);
178 while (isspace(*end)) ++end;
179 if (*end == '\0' && errno == 0 &&
180 ret <= std::numeric_limits<int>::max() &&
181 ret >= std::numeric_limits<int>::min() ) {
182 *value = ret;
183 return true;
184 }
185 return false;
186}
187
188bool FastStringTo64(const char* str, int64_t* value) {
189 char* end = nullptr;

Callers 3

ParseAttributeFunction · 0.85
ParseRecordMethod · 0.85
ParseRecordMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected