Commit 17870007 authored by nagayama15's avatar nagayama15

透かしの埋め込みを修正

parent ecb78409
...@@ -81,18 +81,25 @@ namespace ...@@ -81,18 +81,25 @@ namespace
std::size_t num_embedded_bits = 0; std::size_t num_embedded_bits = 0;
bool is_changed = false; bool is_changed = false;
for (auto& inst : block) for (auto& inst : block)
{ {
if (auto bin_op = llvm::dyn_cast<llvm::BinaryOperator>(&inst)) if (auto bin_op = llvm::dyn_cast<llvm::BinaryOperator>(&inst))
{
if (bit_stream_->read_bit())
{ {
is_changed = !bin_op->swapOperands() || is_changed; is_changed = !bin_op->swapOperands() || is_changed;
}
num_embedded_bits += 1; num_embedded_bits += 1;
} }
else if (auto cmp_inst = llvm::dyn_cast<llvm::CmpInst>(&inst)) else if (auto cmp_inst = llvm::dyn_cast<llvm::CmpInst>(&inst))
{
if (bit_stream_->read_bit())
{ {
cmp_inst->swapOperands(); cmp_inst->swapOperands();
is_changed = true; is_changed = true;
}
num_embedded_bits += 1; num_embedded_bits += 1;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment