| 835 | } |
| 836 | |
| 837 | StateValue AggregateType::extract(const StateValue &val, unsigned index, |
| 838 | bool fromInt) const { |
| 839 | unsigned total_value = 0, total_np = 0; |
| 840 | for (unsigned i = 0; i < index; ++i) { |
| 841 | total_value += children[i]->bits(); |
| 842 | total_np += children[i]->np_bits(fromInt); |
| 843 | } |
| 844 | |
| 845 | unsigned h_val, l_val, h_np, l_np; |
| 846 | if (fromInt && little_endian) { |
| 847 | h_val = total_value + children[index]->bits() - 1; |
| 848 | l_val = total_value; |
| 849 | |
| 850 | h_np = total_np + children[index]->np_bits(fromInt) - 1; |
| 851 | l_np = total_np; |
| 852 | } else { |
| 853 | unsigned high_val = bits() - total_value; |
| 854 | h_val = high_val - 1; |
| 855 | l_val = high_val - children[index]->bits(); |
| 856 | |
| 857 | unsigned high_np = np_bits(fromInt) - total_np; |
| 858 | h_np = high_np - 1; |
| 859 | l_np = high_np - children[index]->np_bits(fromInt); |
| 860 | } |
| 861 | |
| 862 | StateValue sv(val.value.extract(h_val, l_val), |
| 863 | val.non_poison.extract(h_np, l_np)); |
| 864 | return fromInt ? children[index]->fromInt(std::move(sv)) : |
| 865 | children[index]->fromBV(std::move(sv)); |
| 866 | } |
| 867 | |
| 868 | unsigned AggregateType::bits() const { |
| 869 | if (elements == 0) |
no test coverage detected