feat(library/kernel_serializer): compress binder modifier annotations when saving .olean file

This commit is contained in:
Leonardo de Moura 2014-10-13 10:14:56 -07:00
parent bc70e7244d
commit 7d0db4cc60

View file

@ -117,20 +117,23 @@ static expr read_macro_definition(deserializer & d, unsigned num, expr const * a
}
serializer & operator<<(serializer & s, binder_info const & i) {
s.write_bool(i.is_implicit());
s.write_bool(i.is_cast());
s.write_bool(i.is_contextual());
s.write_bool(i.is_strict_implicit());
s.write_bool(i.is_inst_implicit());
unsigned w =
(i.is_implicit() ? 16 : 0) +
(i.is_cast() ? 8 : 0) +
(i.is_contextual() ? 4 : 0) +
(i.is_strict_implicit() ? 2 : 0) +
(i.is_inst_implicit() ? 1 : 0);
s.write_char(w);
return s;
}
static binder_info read_binder_info(deserializer & d) {
bool imp = d.read_bool();
bool cast = d.read_bool();
bool ctx = d.read_bool();
bool s_imp = d.read_bool();
bool i_imp = d.read_bool();
unsigned w = d.read_char();
bool imp = (w & 16) != 0;
bool cast = (w & 8) != 0;
bool ctx = (w & 4) != 0;
bool s_imp = (w & 2) != 0;
bool i_imp = (w & 1) != 0;
return binder_info(imp, cast, ctx, s_imp, i_imp);
}