41 Commits
Author SHA1 Message Date
Timofey Solomko f307a7fb0b [BZip2] Improve handling of truncated inputs during decompression 2026-02-23 18:08:27 +08:00
Timofey Solomko 609eb29791 [BZip2] Change a couple of guard/if-checks to assertions 2026-02-23 18:08:26 +08:00
Timofey Solomko 1e7154474b [BZip2] Use better versions of bit writer functions
First, write(unsignedNumber:) is better than write(number:) when the argument is already UInt, since it does one fewer precondition check and does not do additional integer conversion. Secondly, using write(number:) to write one bit was very inefficient.
2026-02-23 18:08:25 +08:00
Timofey Solomko 7af76764d7 [BZip2] Use UInt8 arrays instead of Data 2026-02-23 18:08:25 +08:00
Timofey Solomko bff411d511 [BZip2] Improve encoding performance of code lengths deltas 2026-02-23 18:08:25 +08:00
Timofey Solomko 5b5b20f582 [Huffman] Remove codes argument label from EncodingTree.init 2026-02-18 00:12:55 +08:00
Timofey Solomko d8c4527c89 [BZip2] Slightly optimize MTF transform of selectors during compression
It can be statically proven that the output of MTF transform lies within a certain range, so a guard check can be replaced with an assertion.
2026-02-11 17:21:52 +08:00
Timofey Solomko e7c4c13543 [BZip2] Code comments clarification 2026-02-11 17:21:48 +08:00
Timofey Solomko ea9aaccfb9 Update copyright year to 2026 2026-01-31 15:30:24 +08:00
Timofey Solomko ed66991cbd Update copyright year to 2024 2024-01-11 16:57:04 +03:00
Timofey Solomko 43132fc39d Update copyright year to 2023 2023-02-07 15:31:45 +02:00
Timofey Solomko 79295db930 Update copyright year to 2022 2022-01-08 15:02:59 +03:00
Timofey Solomko 7a43328b8e [BZip2] Rename crc32 function for bzip2 2021-10-22 21:55:33 +03:00
Timofey Solomko 73dec6720e [BZip2] Combine MTF and RLE steps in compression 2021-05-22 23:35:03 +03:00
Timofey Solomko b5e98b66cd [BZip2] Explain zero RLE in the comments
(cherry picked from commit 1f7a5352a7)
2021-05-13 23:51:52 +03:00
Timofey Solomko 1fca632c2d Update copyright year to 2021 2021-03-26 13:50:20 +02:00
Timofey Solomko a844b34436 Update copyright year to 2020 2020-03-20 09:43:42 +03:00
Timofey Solomko 94ab3ba1f5 Replace usage of deprecated index(...) functions with the new ones 2020-03-20 09:41:52 +03:00
Timofey Solomko 04f64bcb72 Rename Encoding/DecodingHuffmanTree to just Encoding/DecodingTree 2019-03-12 22:31:35 +03:00
Timofey Solomko 142fd44dd2 Remove old CodeLength initializer from Encoding(Huffman)Tree 2019-03-12 22:31:24 +03:00
Timofey Solomko c4c4063923 [docs] Small improvements to various BZip2 documentation 2019-01-04 14:59:13 +03:00
Timofey Solomko ce47019097 Update copyright year to 2019 2019-01-02 23:15:43 +03:00
Timofey Solomko 1c5ca3bbe5 Swiflinted before 4.4.0 2018-08-07 21:18:39 +03:00
Timofey Solomko 1d838c1d7e Slightly simplify and improve certain code 2018-04-07 13:38:00 +03:00
Timofey Solomko cb9d181754 [BZip2] Don't create new Huffman trees if maximum amount of trees possible is already reached 2018-03-03 20:30:49 +03:00
Timofey Solomko e710e37233 [BZip2] Add comments about smaller block size for compression 2018-01-29 19:55:42 +03:00
Timofey Solomko 7d99ab176a [BZip2] Use not-reduced block size for decompression 2018-01-17 12:01:00 +03:00
Timofey Solomko d8a47efd44 [BZip2] Slightly optimise initial RLE in compress 2018-01-14 23:07:09 +03:00
Timofey Solomko 02fb0c2886 [BZip2] Fix incorrect block sizes in compression
I previously thought that 1KB = 1024 bytes, but apparently in this case it is just 1000 bytes.
2018-01-14 18:17:44 +03:00
Timofey Solomko 44f33bf02a Make bit reader and writer functions' parameters concrete classes
Previously, it was almost always protocols, which in some cases didn't make sense.
2018-01-07 22:27:36 +03:00
Timofey Solomko b035d910a0 Rewrite BZip2.BlockSize.headerByte() as computed properties 2018-01-05 15:03:47 +03:00
Timofey Solomko 9f4884adc8 Refactor bzip2 block size parsing 2018-01-03 23:41:20 +03:00
Timofey Solomko e714dc308b Updated copyright year to 2018 2018-01-03 19:44:18 +03:00
Timofey Solomko bb39c4016c Replace SWCompression.BitWriter with BitByteData's one 2018-01-03 19:22:15 +03:00
Timofey Solomko cef8ab12a2 Rename BitWriter.finish() to align 2018-01-03 19:22:13 +03:00
Timofey Solomko 15c06843b1 Replace BitWriter.buffer with Data 2018-01-03 19:22:13 +03:00
Timofey Solomko e05f917210 Improve compile time 2017-12-24 14:57:35 +03:00
Timofey Solomko 7eacfe7ab6 Extract private functions for stages of bzip2 processing 2017-10-07 15:16:21 +03:00
Timofey Solomko 9abb475e2b Simplify write of used bytes map and selectors used in bzip2 2017-10-07 15:15:08 +03:00
Timofey Solomko 5da624e75f Use new data slicing in bzip2 compress 2017-10-07 12:28:03 +03:00
Timofey Solomko 843896edcf Move source code files into subfolders 2017-10-06 23:10:01 +03:00