Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

Deflate / Deflate_compress yields different result

Featured Replies

  • Author
  • Localization

LostMahPants, posted Thu Oct 12, 2017 6:54 pm (27264)


So, decompressing and compressing result back with Deflate gives different result. Which makes me think i'm missing something.
Code:
comtype deflate

math SIZE = 32
math ZSIZE = 26

clog MEMORY_FILE 0 ZSIZE SIZE
log Decompressed.pak 0 SIZE MEMORY_FILE

comtype deflate_compress
clog MEMORY_FILE2 0 ZSIZE SIZE MEMORY_FILE
log Recompressed.pak 0 ZSIZE MEMORY_FILE2

comtype deflate
clog DecompressedX2.pak 0 ZSIZE SIZE MEMORY_FILE2

example's just a 26 bytes, decompresses to 32 fine.
However, recompressing it back gives result different from original one and decompressing it once more loses 6 bytes.

Am I just monumentally retarded and missed something obvious or is it just the intended behavior by design?
Thanks in advance for explanation.
  • Author
  • Localization

aluigi, posted Thu Oct 12, 2017 7:15 pm (27265)


You made a mistake, check the lines with the "here" comment:
Code:
comtype deflate

math SIZE = 32
math ZSIZE = 26

clog MEMORY_FILE 0 ZSIZE SIZE
log Decompressed.pak 0 SIZE MEMORY_FILE

comtype deflate_compress
clog MEMORY_FILE2 0 SIZE SIZE MEMORY_FILE   # here
get ZSIZE asize MEMORY_FILE2                # here
log Recompressed.pak 0 ZSIZE MEMORY_FILE2

comtype deflate
clog DecompressedX2.pak 0 ZSIZE SIZE MEMORY_FILE2

And yes it's perfectly normal that different implementations of a compression algorithm or different settings produce different compressed results, it's a boring problem which is well known by the users who use the reimporting method with an untouched file to reimport occupies more bytes than the original one even if it's the same.
  • Author
  • Localization

LostMahPants, posted Thu Oct 12, 2017 7:45 pm (27267)


Thank you a lot!
I bet in documentation there's a a good chunky reminder about how to avoid this kind of amateur mistakes, heh. Should've read it more thoroughly before asking...
  • Author
  • Localization

aluigi, posted Thu Oct 12, 2017 10:45 pm (27275)


Don't worry that's ok, feel free to ask everytime you need.
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.