⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stuffer.cpp

📁 QAM module to use in Java with an easy interface and powerful performance
💻 CPP
字号:
//---------------------------------------------------------------------------


#pragma hdrstop

#include "Stuffer.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

__fastcall Stuffer::Stuffer()
{
        workingsize=0;working=0;numberofonesinarow=0;
        GetNextChar=&DefaultGetNextChar;
}

int __fastcall Stuffer::Update()
{
       int i;
       if(workingsize<8)
       {
                int c=GetNextChar();
                int size=8;
                if(c>=0)
                {
                        int place=1;
                        int tmp2;
                        for(int i=0;i<8;i++)
                        {
                                tmp2=c&place;
                                place=place<<1;
                                if(tmp2>0)numberofonesinarow++;
                                 else numberofonesinarow=0;
                                if(numberofonesinarow==5)
                                {
                                        c=((((c)<<1)&(1024-place))|((c)&(place-1)))&(1023-place);
                                        numberofonesinarow=0;
                                        size++;
                                        place=place<<1;
                                }
                        }
                }
                 else{numberofonesinarow=0;c=126;}
                working=working|(c<<workingsize);
                workingsize+=size;
       }
       i=working&255;
       working=working>>8;
       workingsize-=8;
       return i;
}


int __fastcall Stuffer::DefaultGetNextChar(void)
{
        return -1;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -