MCPcopy Create free account
hub / github.com/AliveToolkit/alive2 / extract

Method extract

ir/type.cpp:837–866  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

835}
836
837StateValue 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
868unsigned AggregateType::bits() const {
869 if (elements == 0)

Callers 15

print_model_valMethod · 0.45
canAccessMethod · 0.45
canReadMethod · 0.45
canWriteMethod · 0.45
eq_except_paddingFunction · 0.45
freezeMethod · 0.45
impliesMethod · 0.45
addFnCallMethod · 0.45
fromFloatMethod · 0.45
isNaNMethod · 0.45

Calls 5

np_bitsMethod · 0.80
fromIntMethod · 0.80
fromBVMethod · 0.80
bitsMethod · 0.45
zextOrTruncMethod · 0.45

Tested by

no test coverage detected