mirror of
https://github.com/verilator/verilator.git
synced 2026-10-07 18:42:58 +02:00
Internals: Refactor to decouple LinkDot from ParseImp. No functional change intended.
This commit is contained in:
@@ -121,6 +121,24 @@ bool VString::isWhitespace(const string& str) {
|
||||
return true;
|
||||
}
|
||||
|
||||
double VString::parseDouble(const string& str, bool* successp) {
|
||||
char* strgp = new char[str.size() + 1];
|
||||
char* dp = strgp;
|
||||
if (successp) *successp = true;
|
||||
for (const char* sp = str.c_str(); *sp; ++sp) {
|
||||
if (*sp != '_') *dp++ = *sp;
|
||||
}
|
||||
*dp++ = '\0';
|
||||
char* endp = strgp;
|
||||
double d = strtod(strgp, &endp);
|
||||
size_t parsed_len = endp - strgp;
|
||||
if (parsed_len != strlen(strgp)) {
|
||||
if (successp) *successp = false;
|
||||
}
|
||||
VL_DO_DANGLING(delete[] strgp, strgp);
|
||||
return d;
|
||||
}
|
||||
|
||||
//######################################################################
|
||||
// VHashSha256
|
||||
|
||||
|
||||
Reference in New Issue
Block a user