Giter Club home page Giter Club logo

micro-lzmadec's Introduction

Micro LZMA decoder

Code Golf in Assembly with the goal of writing the smallest LZMA decoder.

Includes x86_64 version for Linux and Windows, and x86/x86_64 static version for use in compressed executables (see test_static.c for an example of usage).

Needs nasm to compile.

Results

x86_64 Linux binary: 817 bytes (120 headers, 697 code)
x86_64 Windows binary: 1536 bytes (256 headers, 295 padding, 171 import table, 814 code)
x86_64 static: 483 bytes
x86 static: 480 bytes

Yet it can be improved a little, especially the static version.

Limitations

LZMA archives can have a dictionary size of up to 4 GB, your OS must be able to allocate a buffer of this size for this decoder to work.

Probability Model Map

Notes for a better understanding of the code.

Original:
IsMatch: 0, 192      # state << 4 | posState
IsRep: 192, 12       # state
IsRepG0: 204, 12     # state
IsRepG1: 216, 12     # state
IsRepG2: 228, 12     # state
IsRep0Long: 240, 192 # state << 4 | posState
PosSlot: 432, 256
SpecPos: 688, 114
Align: 802, 16
LenCoder: 818, 2 + 512
RepLenCoder: 1332, 2 + 512
Literal: 1846, 0
New:
Align: 0, 16
IsRep{,G0,G1,G2}: 16, 4*12       # state * 4
IsMatch, IsRep0Long: 64, 2*192	# (state << 4 | posState) * 2
PosSlot: 448, 256
SpecPos: 704, 114 + 1 (padding)
LenCoder: 819, 2 + 511
RepLenCoder: 1332, 2 + 511 + 203 (padding)
Literal: 2048, 0

micro-lzmadec's People

Contributors

ilyakurdyukov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.