1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Fix compression ratio check.

This commit is contained in:
Markus F.X.J. Oberhumer 2006-11-20 13:48:34 +01:00
parent e338918773
commit 2f483ec8e8

View File

@ -305,12 +305,12 @@ bool Packer::checkDefaultCompressionRatio(unsigned u_len, unsigned c_len) const
return false; return false;
unsigned gain = u_len - c_len; unsigned gain = u_len - c_len;
if (gain < 512) // need at least 512 bytes gain if (gain < 512) // need at least 512 bytes gain
return false; return false;
#if 1 #if 1
if (gain >= 4096) // ok if we have 4096 bytes gain if (gain >= 4096) // ok if we have 4096 bytes gain
return true; return true;
if (c_len >= u_len - u_len / 8) // ok if we have 12.5% gain if (gain >= u_len / 16) // ok if we have 6.25% gain
return true; return true;
return false; return false;
#else #else