This commit is contained in:
2026-07-12 10:54:44 +02:00
parent f4a005410d
commit 974c7e6dcf
+16 -16
View File
@@ -57,30 +57,30 @@ fn write_u32(mut b Bits, value u32) {
// GZIP // GZIP
fn write_gzip_header(mut b Bits) { fn write_gzip_header(mut b Bits) {
write_byte(mut b, 0x1f) write_byte(mut b, 0x1f) // MAGIC
write_byte(mut b, 0x8b) write_byte(mut b, 0x8b) // BYTES
write_byte(mut b, 0x08) write_byte(mut b, 0x08) // COMPRESSION (8, DEFLATE)
write_byte(mut b, 0x00) write_byte(mut b, 0x00) // FLAG (0, NO FIELDS)
write_u32(mut b, 0) write_u32(mut b, 0) // CREATION TIME (FOFERK WAS CREATED AT THE DAWN OF TIME)
write_byte(mut b, 0x00) write_byte(mut b, 0x00) // XFL (0, SOME SPECIAL COMPRESSION THING, HAS TO BE LIKE THAT)
write_byte(mut b, 0x03) write_byte(mut b, 0x03) // OS (3, UNIX)
} }
// DEFLATE // DEFLATE
fn write_deflate_header(mut b Bits) { fn write_deflate_header(mut b Bits) {
write_lsb(mut b, 0x01, 1) write_lsb(mut b, 0x01, 1) // BFINAL (1, LAST BLOCK)
write_lsb(mut b, 0x01, 2) write_lsb(mut b, 0x01, 2) // BTYPE (0, FIXED HUFFMAN TREE)
} }
fn write_foferk(mut b Bits) { fn write_foferk(mut b Bits) {
write_msb(mut b, 0x96, 8) write_msb(mut b, 0x96, 8) // 'f' + 30
write_msb(mut b, 0x9f, 8) write_msb(mut b, 0x9f, 8) // 'o' + 30
write_msb(mut b, 0x96, 8) write_msb(mut b, 0x96, 8) // 'f' + 30
write_msb(mut b, 0x95, 8) write_msb(mut b, 0x95, 8) // 'e' + 30
write_msb(mut b, 0xA2, 8) write_msb(mut b, 0xA2, 8) // 'r' + 30
write_msb(mut b, 0x9b, 8) write_msb(mut b, 0x9b, 8) // 'k' + 30
write_msb(mut b, 0x50, 8) write_msb(mut b, 0x50, 8) // ' ' + 30
} }
fn write_tokens(mut b Bits, repeat int) { fn write_tokens(mut b Bits, repeat int) {