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) { serializer & operator<<(serializer & s, binder_info const & i) {
s.write_bool(i.is_implicit()); unsigned w =
s.write_bool(i.is_cast()); (i.is_implicit() ? 16 : 0) +
s.write_bool(i.is_contextual()); (i.is_cast() ? 8 : 0) +
s.write_bool(i.is_strict_implicit()); (i.is_contextual() ? 4 : 0) +
s.write_bool(i.is_inst_implicit()); (i.is_strict_implicit() ? 2 : 0) +
(i.is_inst_implicit() ? 1 : 0);
s.write_char(w);
return s; return s;
} }
static binder_info read_binder_info(deserializer & d) { static binder_info read_binder_info(deserializer & d) {
bool imp = d.read_bool(); unsigned w = d.read_char();
bool cast = d.read_bool(); bool imp = (w & 16) != 0;
bool ctx = d.read_bool(); bool cast = (w & 8) != 0;
bool s_imp = d.read_bool(); bool ctx = (w & 4) != 0;
bool i_imp = d.read_bool(); bool s_imp = (w & 2) != 0;
bool i_imp = (w & 1) != 0;
return binder_info(imp, cast, ctx, s_imp, i_imp); return binder_info(imp, cast, ctx, s_imp, i_imp);
} }