MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / largeInt

Function largeInt

src/DesignCompile/CompileExpression.cpp:421–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419}
420
421static bool largeInt(std::string_view str) {
422 bool isSigned = false;
423 size_t pos = str.find('\'');
424 if (pos != std::string::npos) {
425 if (str.find_first_of("sS") != std::string::npos) {
426 isSigned = true;
427 str = str.substr(pos + 3);
428 } else {
429 str = str.substr(pos + 2);
430 }
431 }
432 std::string value(str);
433 value = StringUtils::replaceAll(value, "_", "");
434 bool isLarge = false;
435 if (value.size() > 20) {
436 isLarge = true;
437 } else if (value.size() == 20) {
438 if (isSigned) {
439 int64_t test = 0;
440 isLarge = NumUtils::parseInt64(value, &test) == nullptr;
441 } else {
442 uint64_t test = 0;
443 isLarge = NumUtils::parseUint64(value, &test) == nullptr;
444 }
445 }
446 return isLarge;
447}
448
449constant *compileConst(const FileContent *fC, NodeId child, Serializer &s) {
450 VObjectType objtype = fC->Type(child);

Callers 1

compileConstFunction · 0.85

Calls 2

parseInt64Function · 0.85
parseUint64Function · 0.85

Tested by

no test coverage detected