| 807 | } |
| 808 | |
| 809 | StateValue AggregateType::aggregateVals(const vector<StateValue> &vals) const { |
| 810 | assert(vals.size() + numPaddingsConst() == elements); |
| 811 | // structs can be empty |
| 812 | if (elements == 0) |
| 813 | return { expr::mkUInt(0, 1), expr::mkUInt(0, 1) }; |
| 814 | |
| 815 | StateValue v; |
| 816 | bool first = true; |
| 817 | unsigned val_idx = 0; |
| 818 | for (unsigned idx = 0; idx < elements; ++idx) { |
| 819 | if (children[idx]->bits() == 0) { |
| 820 | assert(!isPadding(idx)); |
| 821 | val_idx++; |
| 822 | continue; |
| 823 | } |
| 824 | |
| 825 | StateValue vv; |
| 826 | if (isPadding(idx)) |
| 827 | vv = children[idx]->getDummyValue(false); |
| 828 | else |
| 829 | vv = vals[val_idx++]; |
| 830 | vv = children[idx]->toBV(std::move(vv)); |
| 831 | v = first ? std::move(vv) : v.concat(vv); |
| 832 | first = false; |
| 833 | } |
| 834 | return v; |
| 835 | } |
| 836 | |
| 837 | StateValue AggregateType::extract(const StateValue &val, unsigned index, |
| 838 | bool fromInt) const { |
no test coverage detected