Skip to content

Commit

Permalink
Fix CompareEqual instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
timoschwarzer committed Aug 11, 2024
1 parent 3ff995a commit 672acff
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion projects/Randomizer/seed/instructions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,16 @@ namespace randomizer::seed {
EqualityComparator op;

void execute(Seed& seed, SeedMemory& memory) const override {
memory.booleans.set(0, op == EqualityComparator::Equal && memory.get<T>(0) == memory.get<T>(1));
switch (op) {
case EqualityComparator::Equal:
memory.booleans.set(0, memory.get<T>(0) == memory.get<T>(1));
break;
case EqualityComparator::NotEqual:
memory.booleans.set(0, memory.get<T>(0) != memory.get<T>(1));
break;
}

throw RandoException("Invalid operator in CompareEqual instruction");
}

[[nodiscard]] std::string to_string(const Seed& seed, const SeedMemory& memory) const override {
Expand Down

0 comments on commit 672acff

Please sign in to comment.