From e81b8fa068cca1f7e38803f15a1b7c1c3adab0c8 Mon Sep 17 00:00:00 2001 From: ikpil Date: Sun, 1 Oct 2023 18:10:42 +0900 Subject: [PATCH] feat: estimate compressed size --- src/DotFastLZ.Compression/FastLZ.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/DotFastLZ.Compression/FastLZ.cs b/src/DotFastLZ.Compression/FastLZ.cs index 1c46651..c1c7f3a 100644 --- a/src/DotFastLZ.Compression/FastLZ.cs +++ b/src/DotFastLZ.Compression/FastLZ.cs @@ -639,5 +639,11 @@ public static void MemMove(byte[] dest, long destOffset, byte[] src, long srcOff dest[destOffset + i] = src[srcOffset + i]; } } + + public static long EstimateCompressedSize(long size) + { + long estimatedSize = (long)Math.Ceiling(size * 1.06f); + return Math.Max(estimatedSize, 66); + } } } \ No newline at end of file