Skip to content

Commit

Permalink
use sort.bits if lit string doesn't contain precision
Browse files Browse the repository at this point in the history
  • Loading branch information
dwightguth committed Dec 3, 2024
1 parent 93f37f8 commit c7a582e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/codegen/CreateStaticTerm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,15 @@ create_static_term::create_token(value_type sort, std::string contents) {
assert(false && "not implemented yet: tokens");
case sort_category::MInt: {
size_t idx = contents.find_first_of("pP");
assert(idx != std::string::npos);
uint64_t bits = std::stoi(contents.substr(idx + 1));
uint64_t bits{};
if (idx == std::string::npos) {
bits = sort.bits;
} else {
bits = std::stoi(contents.substr(idx + 1));
contents = contents.substr(0, idx);
}
return llvm::ConstantInt::get(
llvm::IntegerType::get(ctx_, bits), contents.substr(0, idx), 10);
llvm::IntegerType::get(ctx_, bits), contents, 10);
}
case sort_category::Bool:
return llvm::ConstantInt::get(
Expand Down

0 comments on commit c7a582e

Please sign in to comment.