This is an archive of the discontinued LLVM Phabricator instance.

Use the same constants as zlib to represent compression level.
ClosedPublic

Authored by ruiu on Aug 2 2018, 11:18 AM.

Details

Summary

This change allows users pass compression level that was not listed
in the enum. Also, I think using different values than zlib's
compression levels was just confusing.

Diff Detail

Repository
rL LLVM

Event Timeline

ruiu created this revision.Aug 2 2018, 11:18 AM
pcc accepted this revision.Aug 2 2018, 12:03 PM

LGTM

This revision is now accepted and ready to land.Aug 2 2018, 12:03 PM
This revision was automatically updated to reflect the committed changes.

Looks like this change removes/reduces some type safety - by moving to an
int parameter.

Could the enum be kept, but with all the values supported? (an enum's
representable values includes at least (actually more than - round up to
the nearest number of bits required) all the values smaller than the
largest enumerator - so an enum with the BestSize value will be usable for
all the others (eg: even with an enum class which doesn't allow implicit
conversions, a user could write (CompressionLevel)3 to get that specific
level).