Skip to content

Instantly share code, notes, and snippets.

@folkertdev
Created November 27, 2024 20:42
Show Gist options
  • Select an option

  • Save folkertdev/2d0399e92c88340a30109e55b1430961 to your computer and use it in GitHub Desktop.

Select an option

Save folkertdev/2d0399e92c88340a30109e55b1430961 to your computer and use it in GitHub Desktop.

Revisions

  1. folkertdev created this gist Nov 27, 2024.
    53 changes: 53 additions & 0 deletions input.c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,53 @@
    typedef unsigned char Bool;
    typedef unsigned char UChar;
    typedef int Int32;
    typedef unsigned int UInt32;
    #define True ((Bool)1)
    #define BZ_X_MAGIC_1 10
    typedef struct {
    char *next_in;
    }
    bz_stream;
    typedef struct {
    bz_stream* strm;
    Int32 state;
    UInt32 bsBuff;
    Int32 bsLive;
    }
    DState;
    #define GET_BITS(lll,vvv,nnn) \
    case lll: s->state = lll; \
    while (True) { \
    if (s->bsLive >= nnn) { \
    break; \
    } \
    s->bsBuff \
    = (s->bsBuff << 8) | \
    ((UInt32) \
    (*((UChar*)(s->strm->next_in)))); \
    }
    #define GET_UCHAR(lll,uuu) \
    GET_BITS(lll,uuu,8)
    Int32 BZ2_decompress ( DState* s ) {
    Int32 retVal;
    Int32 i;
    Int32 alphaSize;
    Int32 nSelectors;
    Int32 EOB;
    Int32 nextSym;
    switch (s->state) {
    GET_UCHAR(BZ_X_MAGIC_1, uc);
    for (i = 0;
    i < nSelectors;
    i++) {
    for (i = 0;
    i < alphaSize;
    i++) {
    }
    }
    while (True) {
    if (nextSym == EOB) break;
    }
    }
    save_state_and_return: return retVal;
    }