Skip to content

Commit

Permalink
Change the constant used for dynamic sized quake.veq type.
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Schweitz <[email protected]>
  • Loading branch information
schweitzpgi committed Dec 12, 2024
1 parent 105c05a commit 7514e47
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions include/cudaq/Optimizer/Dialect/Quake/QuakeTypes.td
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,12 @@ def VeqType : QuakeType<"Veq", "veq"> {
let hasCustomAssemblyFormat = 1;

let extraClassDeclaration = [{
bool hasSpecifiedSize() const { return getSize(); }
static constexpr std::size_t kDynamicSize =
std::numeric_limits<std::size_t>::max();

bool hasSpecifiedSize() const { return getSize() != kDynamicSize; }
static VeqType getUnsized(mlir::MLIRContext *ctx) {
return VeqType::get(ctx, 0);
return VeqType::get(ctx, kDynamicSize);
}
}];
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Optimizer/Dialect/Quake/QuakeTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ void quake::VeqType::print(AsmPrinter &os) const {
Type quake::VeqType::parse(AsmParser &parser) {
if (parser.parseLess())
return {};
std::size_t size = 0;
std::size_t size = kDynamicSize;
if (succeeded(parser.parseOptionalQuestion()))
size = 0;
size = kDynamicSize;
else if (parser.parseInteger(size))
return {};
if (parser.parseGreater())
Expand Down

0 comments on commit 7514e47

Please sign in to comment.