#include
#include
typedef unsigned char ubyte;
/*
定数定義
MIN_COMPRESS_SIZE : 最低限の一致長。 : 4
MAX_RELATIVE_POSITION : 相対参照の最大値 : 2^24 - 1
MAX_MATCH_LENGTH : 最大一致長 : 2^13 + 3
*/
static const size_t MIN_COMPRESS_SIZE = 4;
static const size_t MAX_RELATIVE_POSITION = 1=0;now--){
/*出現数0の値があればそのままその値を返してしまう。*/
if(counts[now]==0)return (ubyte)now;
/*出現数が最小のものが複数ある場合はより大きくなるように選定する。*/
else if(counts[now]=((1=((1<<5)+4)){
outsize++;
}
if(max_match_size<(1<<8)){
outsize+=1;
}else if(max_match_size<(1<<16)){
outsize+=2;
}else{
outsize+=3;
}
}
}
}
return outsize;
}
/*実際に出力する関数。*/
size_t compress(const void* psource,size_t srcsize,void *pbuffer,size_t bufsize){
const ubyte *const begin_ptr=(const ubyte*)psource , *now_ptr=begin_ptr , *const end_ptr=begin_ptr+srcsize;
for(;now_ptr<end_ptr;now_ptr++){
}
return 0;
}
やっていることは、Dxライブラリのアーカイバ機能の圧縮の部分を実行するものですが、速度の遅さは相当のものです。
まだまだ未熟だな…